-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJS-Weekend-NextJS.html
447 lines (427 loc) · 16.2 KB
/
JS-Weekend-NextJS.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Next.JS</title>
<meta name="author" content="Petr Šnobelt" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta
name="apple-mobile-web-app-status-bar-style"
content="black-translucent"
/>
<meta
name="viewport"
content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"
/>
<link
rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/reveal.js/3.6.0/css/reveal.min.css"
/>
<link
rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/reveal.js/3.6.0/css/theme/white.css"
id="theme"
/>
<link
rel="shortcut icon"
href="https://nextjs.org/static/favicon/favicon.ico"
/>
<!-- If the query includes 'print-pdf', use the PDF print sheet -->
<script>
document.write(
'<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/reveal.js/3.6.0/css/print/' +
(window.location.search.match(/print-pdf/gi) ? "pdf" : "paper") +
'.css" type="text/css" media="print">'
);
</script>
</head>
<body>
<div class="reveal">
<div class="slides">
<section data-background-color="white">
<header alt="Next.JS">
<svg
xmlns="http://www.w3.org/2000/svg"
width="410"
height="250"
viewBox="0 0 82 50"
>
<path
d="M19.44 13.053h15.475v1.232H20.86v9.278h13.218v1.232H20.859v10.186h14.217v1.233H19.44V13.053zm16.861 0h1.645l7.286 10.185 7.447-10.185L62.809.115 46.166 24.309l8.575 11.905h-1.708l-7.802-10.835-7.834 10.835H35.72l8.64-11.905-8.06-11.256zm19.054 1.232v-1.232H72.99v1.232h-8.125v21.929h-1.418V14.285h-8.092zM.08 13.053h1.773l24.45 36.668L16.2 36.214 1.564 14.804l-.065 21.41H.081V13.053zm72.766 21.556a.502.502 0 0 1-.507-.516c0-.29.217-.516.507-.516a.5.5 0 0 1 .507.516.5.5 0 0 1-.507.516zm1.394-1.357H75c.01.412.31.689.752.689.493 0 .773-.298.773-.855v-3.532h.772v3.535c0 1.004-.58 1.582-1.538 1.582-.9 0-1.518-.56-1.518-1.42zm4.067-.045h.766c.066.474.528.775 1.194.775.621 0 1.077-.322 1.077-.765 0-.38-.29-.61-.95-.765l-.641-.156c-.9-.21-1.311-.647-1.311-1.381 0-.89.724-1.482 1.811-1.482 1.011 0 1.75.592 1.794 1.433h-.752c-.072-.46-.472-.747-1.052-.747-.61 0-1.018.294-1.018.744 0 .357.262.56.911.713l.549.135c1.02.24 1.442.655 1.442 1.406 0 .955-.739 1.554-1.919 1.554-1.104 0-1.845-.57-1.9-1.464z"
></path>
</svg>
</header>
<h3 class="fragment">
is a lightweight framework for static and server-rendered
applications.
</h3>
<p>
<small>
<a href="mailto:[email protected]">Petr Šnobelt</a> |
<a href="http://twitter.com/petrsnobelt">@petrsnobelt</a>
</small>
</p>
</section>
<section>
<h2>Agenda</h2>
<ul>
<li>NextJS introduction</li>
<li>Why next</li>
<li>Selected examples</li>
<li>Little Live Coding</li>
</ul>
</section>
<section>
<h2>Next.js facts</h2>
<ul>
<li>Developed by <a href="https://zeit.co/">Zeit</a> (now, socket.io)</li>
<li>
<a href="https://github.com/zeit/next.js/releases/tag/1.0.0">
Initial public release in 25 Oct 2016</a
>
</li>
<li>opensource</li>
<li>
current stable release
<a href="https://github.com/zeit/next.js/releases/tag/7.0.2"
>7.0.2 (11 Oct 2018)</a
>
</li>
<li>
<ul>
<li>
<a href="https://github.com/zeit/next.js"
>https://github.com/zeit/next.js</a
>
</li>
<li><a href="https://nextjs.org">https://nextjs.org</a></li>
</ul>
</li>
</ul>
</section>
<section>
<section><h1>Reasons to choose next.js</h1></section>
<section>
<h3>Great company “zeit" behind it</h3>
<ul>
<li>founder “Guillermo Rauch” (socket.io)</li>
<li>
They have business model around it:<br />
<a href="https://zeit.co/now"
>Now — Global Serverless Deployments</a
>
</li>
<li><a href="https://zeit.co/about">https://zeit.co/about</a></li>
</ul>
</section>
<section>
<h3>Great project</h3>
<ul>
<li>7 versions so far, minimal api changes</li>
<li>33 717 GitHub 🌟 stars</li>
<li>Continuous development</li>
<li>
Lot of
<a href="https://github.com/zeit/next.js/tree/canary/examples"
>examples</a
>
</li>
<li>
<a href="http://learnnextjs.com/">LearnNextJs.com</a> for
beginners
</li>
<li>
Active community (GitHub/<a href="https://spectrum.chat/next-js"
>spectrum.chat</a
>)
</li>
</ul>
</section>
<section>
<h3>Can be used with different servers or static export</h3>
<ul>
<li>Koa, Hapi, Fastify, Express…</li>
<li>For start you can export to static file and host anywhere</li>
<li class="fragment">for example on Github pages</li>
<li class="fragment">
or <a href="https://zeit.co/now">now</a>,
<a href="https://surge.sh/">surge</a>,
<a href="https://www.netlify.com">netlify</a> ...
</li>
</ul>
</section>
<section>
<h3>Include nice “tricks”</h3>
<ul>
<li>
<abbr title="Server Side Rendering">SSR</abbr> out of the box
with
<a
href="https://github.com/zeit/next.js#fetching-data-and-component-lifecycle"
>
getInitialProps
</a>
</li>
<li>_document, _app (_app introduced in v6)</li>
<li>Every page is “Webpack endpoint”</li>
<li>Link prefetching</li>
<li>Dynamic import</li>
<li>You can extend build in webpack configuration</li>
<li><a href="https://twitter.com/zeithq/status/1050685825367896064">Pass security audit</a></li>
<li>CDN deployment ready (Continuous delivery)</li>
<li>AMP support</li>
</ul>
</section>
<section>
<h3>Do not reinvent the wheel 🙏</h3>
<ul>
<li>
<a
href="https://hackernoon.com/next-js-razzle-cra-why-you-should-use-them-for-a-next-project-a78d320de97f"
>
Please do not write another react boilerplate</a
>
</li>
<li>Join community and help improve Next.js</li>
</ul>
</section>
<section>
<h3>
<a
href="https://spectrum.chat/thread/e425a8b6-c9cb-4cd1-90bb-740fb3bd7541"
>
Notable companies using Next.js
</a>
</h3>
<ul>
<li>Netflix, GitHub, Avocode</li>
<li>Kiwi.com</li>
<li><a href="https://nextjs.org/showcase">Showcase</a></li>
</ul>
</section>
</section>
<section>
<h3>Next specific features</h3>
<ul>
<li class="fragment">static file serving</li>
<li class="fragment">getInitialProps</li>
<li class="fragment">_document</li>
<li class="fragment">_app</li>
<li class="fragment">
Router <spen class="fragment">with prefetching</spen>
</li>
<li class="fragment">
<a href="https://nextjs.org/docs/">https://nextjs.org/docs/</a>
</li>
</ul>
</section>
<section>
<section>
<h3>
<a href="https://github.com/zeit/next.js/tree/master/examples"
>Examples</a
>
I/II.
</h3>
<ol>
<li class="fragment">stars</li>
<li class="fragment">custom server</li>
<li class="fragment">static export</li>
<li class="fragment"><abbr title="GitHub">gh</abbr> pages</li>
<li class="fragment">with inferno (preact) instead of react</li>
<li class="fragment">
and design, aphrodite, fela, glamorous<br />
material-ui, styled-components, style-jsx
</li>
</ol>
</section>
<section>
<h3>
<a href="https://github.com/zeit/next.js/tree/master/examples"
>Examples</a
>
II/II
</h3>
<ol>
<li class="fragment">redux, mobx, mobx-state-tree</li>
<li class="fragment">apollo, firebase</li>
<li class="fragment">electron, pkg</li>
<li class="fragment">flow, typescript</li>
<li class="fragment">jest (storybook)</li>
<li class="fragment">ReasonML</li>
</ol>
</section>
</section>
<section>
<section>
<h3>Our setup</h3>
<ul class="task-list" dir="auto">
<li class="task-list-item">
<a
href="https://github.com/zeit/next.js/tree/canary/examples/with-styled-components"
rel="nofollow noreferrer noopener"
target="_blank"
>Styled-components</a
>
</li>
<li class="task-list-item">
<a
href="https://github.com/zeit/next.js/tree/canary/examples/with-static-export"
rel="nofollow noreferrer noopener"
target="_blank"
>Static Export</a
>
</li>
<li class="task-list-item">
<a
href="https://github.com/zeit/next.js/tree/canary/examples/with-apollo"
rel="nofollow noreferrer noopener"
target="_blank"
>Apollo Client</a
>
</li>
<li
class="task-list-item"
title="(included in later versions automatically)"
>
<a
href="https://github.com/zeit/next.js/tree/canary/examples/gh-pages"
rel="nofollow noreferrer noopener"
target="_blank"
>GitHub pages</a
>
</li>
</ul>
</section>
<section>
<h3>Nice to have</h3>
<ul class="task-list" dir="auto">
<li class="task-list-item">
<a
href="https://github.com/zeit/next.js/tree/canary/examples/with-absolute-imports"
rel="nofollow noreferrer noopener"
target="_blank"
>absolute imports</a
>
</li>
<li class="task-list-item">
<a
href="https://github.com/zeit/next.js/tree/canary/examples/with-flow"
rel="nofollow noreferrer noopener"
target="_blank"
>flow</a
>
</li>
<li class="task-list-item">
<a
href="https://github.com/zeit/next.js/tree/canary/examples/with-jest"
rel="nofollow noreferrer noopener"
target="_blank"
>jest</a
>
</li>
<li class="task-list-item">
<a
href="https://github.com/zeit/next.js/tree/canary/examples/with-dotenv"
rel="nofollow noreferrer noopener"
target="_blank"
>dotenv</a
>
</li>
<li class="task-list-item">
<a
href="https://github.com/zeit/next.js/tree/canary/examples/with-sentry"
rel="nofollow noreferrer noopener"
target="_blank"
>sentry</a
>
</li>
<li
class="task-list-item"
title="(included in later versions automatically)"
>
<a
href="https://github.com/zeit/next.js/tree/canary/examples/with-webpack-bundle-analyzer"
rel="nofollow noreferrer noopener"
target="_blank"
>webpack-bundle-analyzer</a
>
</li>
</ul>
</section>
</section>
<section>
<h2>Questions</h2>
<br />
<h4>
Petr Šnobelt <br />
[email protected] <br />
@petrsnobelt
</h4>
</section>
</div>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/reveal.js/3.6.0/lib/js/head.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/reveal.js/3.6.0/js/reveal.min.js"></script>
<script>
// Full list of configuration options available here:
// https://github.com/hakimel/reveal.js#configuration
Reveal.initialize({
controls: true,
progress: true,
history: true,
center: true,
theme: Reveal.getQueryHash().theme, // available themes are in /css/theme
transition: Reveal.getQueryHash().transition || "concave", // default/cube/page/concave/zoom/linear/fade/none
// Optional libraries used to extend on reveal.js
dependencies: [
{
src:
"https://cdnjs.cloudflare.com/ajax/libs/reveal.js/3.6.0/lib/js/classList.js",
condition: function() {
return !document.body.classList;
}
},
{
src:
"https://cdnjs.cloudflare.com/ajax/libs/reveal.js/3.6.0/plugin/markdown/marked.js",
condition: function() {
return !!document.querySelector("[data-markdown]");
}
},
{
src:
"https://cdnjs.cloudflare.com/ajax/libs/reveal.js/3.6.0/plugin/markdown/markdown.js",
condition: function() {
return !!document.querySelector("[data-markdown]");
}
},
{
src:
"https://cdnjs.cloudflare.com/ajax/libs/reveal.js/3.6.0/plugin/highlight/highlight.js",
async: true,
callback: function() {
hljs.initHighlightingOnLoad();
}
},
{
src:
"https://cdnjs.cloudflare.com/ajax/libs/reveal.js/3.6.0/plugin/zoom-js/zoom.js",
async: true,
condition: function() {
return !!document.body.classList;
}
},
{
src:
"https://cdnjs.cloudflare.com/ajax/libs/reveal.js/3.6.0/plugin/notes/notes.js",
async: true,
condition: function() {
return !!document.body.classList;
}
}
]
});
</script>
</body>
</html>