-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path2017_webperf_meetup.html
More file actions
691 lines (611 loc) · 24.1 KB
/
Copy path2017_webperf_meetup.html
File metadata and controls
691 lines (611 loc) · 24.1 KB
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
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>React Performance</title>
<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, minimal-ui">
<link rel="stylesheet" href="reveal.js/css/reveal.css">
<!--<link rel="stylesheet" href="reveal.js/css/theme/white.css" id="theme">-->
<!--<link rel="stylesheet" href="reveal.js/css/theme/black.css" id="theme">-->
<!--<link rel="stylesheet" href="reveal.js/css/theme/night.css" id="theme">-->
<link rel="stylesheet" href="reveal.js/css/theme/solarized.css" id="theme">
<!-- Code syntax highlighting -->
<link rel="stylesheet" href="reveal.js/lib/css/zenburn.css">
<style>
/*pre code {*/
/*display: block;*/
/*padding: 0.5em;*/
/*background: #FFFFFF !important;*/
/*color: #000000 !important;*/
/*}*/
.right-img {
margin-left: 10px !important;
float: right;
height: 500px;
}
.todo:before {
content: 'TODO: ';
}
.todo {
color: red !important;
}
code span.line-number {
color: lightcoral;
}
.reveal pre code {
max-height: 1000px !important;
}
img {
border: 0 !important;
box-shadow:0 0 0 0 !important;
}
.reveal {
-ms-touch-action: auto !important;
touch-action: auto !important;
}
.reveal h2,
.reveal h3 {
letter-spacing: 2px;
}
.reveal h2 {
font-family: 'Amiri', serif;
/* font-family: 'Times New Roman', Times, serif; */
font-weight: bold;
font-style: italic;
letter-spacing: -2px;
text-transform: none !important;
}
.reveal em {
font-weight: bold;
}
.reveal .highlight {
background-color: #D3337B;
color: white;
}
.reveal .step-subtitle h1 {
letter-spacing: 1px;
}
.reveal .step-subtitle h2,
.reveal .step-subtitle h3 {
text-transform: none;
font-style: italic;
font-weight: normal;
/* font-weight: 400; */
/* font-family: 'Amiri', serif; */
font-family: 'Lobster', serif;
letter-spacing: 1px;
color: #2aa198;
text-decoration: underline;
}
</style>
<!-- Printing and PDF exports -->
<script>
var link = document.createElement('link');
link.rel = 'stylesheet';
link.type = 'text/css';
link.href = window.location.search.match(/print-pdf/gi) ? 'reveal.js/css/print/pdf.css' : 'reveal.js/css/print/paper.css';
document.getElementsByTagName('head')[0].appendChild(link);
</script>
<!--[if lt IE 9]>
<script src="reveal.js/lib/js/html5shiv.js"></script>
<![endif]-->
</head>
<body>
<div class="reveal">
<!-- Any section element inside of this container is displayed as a slide -->
<div class="slides">
<!--
In diesem Talk zeigen wir dir Möglichkeiten, wie du React-Anwendungen mit programmatischen Mitteln beschleunigen kannst
und wann das überhaupt sinnvoll ist.
Dazu kommen Tipps für einen auf Größe und Geschwindigkeit optimierten Build mit Webpack 3.
Dauer: bummelig 25 Minuten
-->
<section data-markdown class="preparation">
<script type="text/template">
# Vorbereitung
- Server Starten (Demos brauchen den)
- Async Beispiel 1 starten:
- cd code/sandbox/code-splitting
- npm start
- muss dann auf htt://localhost:9000 laufen
- Async Beispiel 2 (Greeting-Variante) starten
- cd code/schritte/redux/9-redux-async-import
- npm start
- Beispiel läuft auf http://localhost:9010
- Universal Rendering starten
- cd code/architecture/universal
- npm install
- npm start
- Checken, dass localhost:3001 im Browser läuft
</script>
</section>
<section>
<h1>React Performance</h1>
<h2><a href="https://www.meetup.com/de-DE/Hamburg-Web-Performance-Group/events/241264722/" target="_blank">Web Performance Meetup </a></h2>
<p>
<a href="http://nilshartmann.net">Nils Hartmann</a> / <a href="http://twitter.com/nilshartmann">@nilshartmann</a>
</p>
<p>
<a href="http://zeigermann.eu">Oliver Zeigermann</a> / <a href="http://twitter.com/djcordhose">@DJCordhose</a>
</p>
<p><small>Folien: <a href="http://bit.ly/webperf-react-performance">http://bit.ly/webperf-react-performance</a></small></p>
</section>
<!--<section class="todo">-->
<!--<pre>-->
<!--</pre>-->
<!--</section>-->
<section>
<h1>Themen</h1>
<ol>
<li><a href="#optimizeruntime">Rendering</a>
<li><a href="#optimize-build">Build</a>
<li><a href="#universal">Universal Rendering</a>
</ol>
</section>
<section id="optimizeruntime" class="step-subtitle">
<h2>Optimierungen (1)</h2>
<h1>Rendering</h1>
</section>
<section>
<h2>Problem: React rendert oft <b>zu viel</b></h2>
</section>
<section>
<h3>Beispiel: SVG Boxes</h3>
<a href="code/sandbox/optimize/public" target="_blank">
<img src="images/screenshot_svg.png" height="500px">
</a>
<p>Eine einzelne Box mit D'n'D verschieben</p>
</section>
<section>
<h3>SVG Boxes</h3>
<img src="ai/box-app-01-initial.png" />
</section>
<section>
<h3>Rendering <b>aller</b> Komponenten</h3>
<img src="ai/box-app-02-after-mouse-event.png" />
</section>
<section>
<h2>Change Detection auf der Ebene des Virtual DOM</h2>
<p>bei jeder Bewegung der Maus werden alle Boxen neu gerendert</p>
<p>Nicht direkt im DOM, sondern in einer leichtgewichtigen Datenstruktur (Virtual DOM)</p>
<p>Änderungen im echten DOM werden aus Änderungen im Virtual DOM errechnet</p>
</section>
<section>
<h2>Change Detection auf der Ebene des Models</h2>
<p><strong>shouldComponentUpdate</strong> ist eine Lifecycle-Methode einer Komponente
die diese Prozedur abkürzen kann</p>
<p>das alte Modell kann mit dem neuen verglichen werden</p>
<p>Das reduziert das Neu-Rendering auf genau die <strong>notwendigen Elemente</strong></p>
<p>Macht nur Sinn, wenn der Check auf Modell-Änderung sehr billig ist, typischerweise <em><strong>===</strong></em></p>
</section>
<section>
<h3>Die Box Component</h3>
<pre><code data-trim contenteditable class="line-numbers" data-leftpad>
class Box extends React.Component {
shouldComponentUpdate(nextProps) {
// simple check: every change to a box creates a new object
const changed = this.props.box !== nextProps.box;
return changed;
}
render() {
const {box} = this.props;
return <rect data-id={box.id} x={box.x} y={box.y}
width="10" height="10"
stroke="black" fill="transparent" strokeWidth="1"/>;
}
}
</code></pre>
</section>
<section>
<h2><small>Naiver Code für Modifikation einer Box</small></h2>
<h3>In BoxApp</h3>
<pre><code data-trim contenteditable class="line-numbers" data-leftpad>
updateBox(id, x, y) {
const {boxes} = this.state;
const modifiedBox = {
id,
x,
y
};
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/
// Reference/Global_Objects/Array/slice
const boxesBefore = boxes.slice(0, id);
const boxesAfter = boxes.slice(id + 1);
const modifiedBoxes = [...boxesBefore, modifiedBox, ...boxesAfter];
this.setState({
boxes: modifiedBoxes
});
}
</code></pre>
<p><a href="code/sandbox/optimize/src/App.js" target="_blank">Kompletter Code</a></p>
</section>
<section>
<h3>Immutable.js</h3>
<p>Immutable persistent data collections for Javascript which increase efficiency and simplicity.</p>
<p><a href="http://facebook.github.io/immutable-js/" target="_blank">http://facebook.github.io/immutable-js/</a></p>
<ul>
<li>Bietet List, Set, Map, etc.
<li>Jede Modifikaton einer Collection erzeugt ein neues Collection Objekt
<li>Kopiert nicht die komplette Collection, sondern effiziente Erzeugung mittels
<a href="https://en.wikipedia.org/wiki/Persistent_data_structure" target="_blank">Persistent Data Structures</a>
</ul>
</section>
<section>
<h3>Mit immutable.js</h3>
<pre><code data-trim contenteditable class="line-numbers" data-leftpad>
import {List} from 'immutable';
this.state = {
boxes: List(boxes)
};
</code></pre>
<pre><code data-trim contenteditable class="line-numbers" data-leftpad>
updateBox(id, x, y) {
const {boxes} = this.state;
const modifiedBox = {
id,
x,
y
};
const modifiedBoxes = boxes.set(id, modifiedBox);
this.setState({
boxes: modifiedBoxes
});
}
</code></pre>
<p><a href="code/sandbox/optimize/src/AppImmutable.js" target="_blank">Kompletter Code</a></p>
</section>
<section id="optimize-build" class="step-subtitle">
<h2>Optimierungen (2)</h2>
<h1>Build</h1>
</section>
<!--<section>-->
<!--<h3>Kudos an Webpack</h3>-->
<!--<p>Jeder kann ein Sponsor werden</p>-->
<!--<a href="https://opencollective.com/webpack#contributors" target="_blank"><img src="images/olli-webpack-sponsor.png"></a>-->
<!--<p><small><a href="https://opencollective.com/webpack#contributors" target="_blank">-->
<!--https://opencollective.com/webpack#contributors-->
<!--</a></small></p>-->
<!--</section>-->
<section>
<h2>Produktionsbuild I</h2>
<p>Minifizieren, Optimieren und alle React-Warnungen herauskompilieren:</p>
<pre><code data-trim contenteditable class="line-numbers" data-leftpad>
webpack --optimize-minimize
--define process.env.NODE_ENV=\"'production'\"
</code></pre>
<p style="font-size:80%">Oder als Kurzform (ab Webpack 2):</p>
<pre><code data-trim contenteditable class="line-numbers" data-leftpad>
webpack -p
</code></pre>
<p style="font-size:80%">(<a href="http://lisperator.net/uglifyjs/" target="_blank">Nutzt Uglify</a>)</p>
<p><a href="https://webpack.js.org/guides/production-build/" target="_blank">https://webpack.js.org/guides/production-build/</a></p>
<p style="font-size:80%">(Hinweis: <code>NODE_ENV</code> wird in der <code>webpack.config</code> nicht gesetzt!)</p>
</section>
<section>
<h2>Produktionsbuild II</h2>
<p>SourceMaps in eigene Datei schreiben (Webpack Konfiguration):</p>
<pre><code data-trim contenteditable class="line-numbers" data-leftpad>
devtool: 'source-map'
</code></pre>
<p>...oder ganz ausschalten:</p>
<pre><code data-trim contenteditable class="line-numbers" data-leftpad>
devtool: 'none'
</code></pre>
<p>(Kein Unterschied hinsichtlich Performance)</p>
</section>
<section>
<h2>Tree Shaking</h2>
<p><em>Entfernt toten Code aus dem generierten JavaScript File</em></p>
<ul class="fragment"}>
<li>Reduziert die Größe der Ausgabedatei</li>
<li>Verfügbar ab Webpack 2.x</li>
<li>Automatisch eingeschaltet, wenn mit <code>-p</code> aufgerufen</li>
<li>Arbeitet auf Basis statischer Code-Analyse der ES6 Imports und Exports</li>
<li>Anpassung in <code>.babelrc</code>: <pre><code data-trim contenteditable class="line-numbers" data-leftpad>
"presets": [["es2015", { "modules": false }]
</code></pre>
</li>
<li><a href="https://webpack.js.org/guides/tree-shaking/" target="_blank">https://webpack.js.org/guides/tree-shaking/</a> </li>
</ul>
</section>
<section>
<h2>Code Splitting</h2>
<p><em>Asynchrones Nachladen von Modulen</em></p>
<ul>
<li>Erlaubt das dynamische Nachladen von Code-Teilen
<li>So kann am Anfang für eine schnelle Ladezeit nur eine Minimalversion ausgespielt werden
<li>Weitere Teile können unmittelbar oder erst nach Nutzerinteraktion nachgeladen werden
<li>Basiert auf <a href="https://github.com/tc39/proposal-dynamic-import">dynamic import</a>, der bereits in Stage 3 ist
</ul>
<p><a href="https://webpack.js.org/guides/code-splitting-async/" target="_blank">https://webpack.js.org/guides/code-splitting-async/</a></p>
</section>
<section>
<h2>Code Splitting</h2>
<h3>Beispiel Code</h3>
<div>
<p>Voraussetzung: Babel Plug-in</p>
<pre><code data-trim>npm install babel-plugin-syntax-dynamic-import --save</code></pre>
<pre><code data-trim>
// .babelrc
"presets": [["es2015", { "modules": false }], ...]
"plugins": ["syntax-dynamic-import", ...]
</code></pre>
</div>
</section>
<section>
<h2>Code Splitting</h2>
<h3>Beispiel Code</h3>
<p>Ein Modul...</p>
<pre><code data-trim>
// calculator.js
export default function calculator(a, b) {
return a+b;
}
</code></pre>
<div class="fragment">
<p>...dynamisch laden:</p>
<pre><code class="javascript" data-trim>
import('./calculator')
.then(calculatorModule => {
// entspricht: import calculator from './calculator';
const calculator => calculatorModule.default
console.log(calculator(7, 8));
});
</code></pre>
<p><a href="http://localhost:9000/" target="_blank">Demo</a></p>
</div>
</section>
<section>
<h2>Code Splitting</h2>
<h3>Nachladen von React-Komponenten</h3>
<div class="fragment">
<span style="font-size: 80%">
<ul>
<li>Erfordert die Darstellung von Platzhaltern, bis die eigentliche Komponente da ist
<li>Wenn die Komponente da ist, muss die umschließende Komponente neu dargestellt werden
<li><em>forceUpdate</em> erzwingt ein Neuladen
<li>Fertige Lösung für React: <a href="https://github.com/thejameskyle/react-loadable" target="_blank">React Loadable</a></li>
</ul>
</span>
</div>
</section>
<section>
<h2>Code Splitting</h2>
<h3>Beispiel: Nachladen von React-Komponenten</h3>
<div>
<pre><code class="javascript" data-trim>
class AsyncComponent extends React.Component {
componentDidMount() {
import(/* webpackChunkName: "component" */ './Component')
.then(ComponentModule => {
this.Component = ComponentModule.default;
this.forceUpdate();
});
}
render() {
return this.Component ?
<this.Component /> : <span>Loading...</span>;
}
}
</code></pre>
<p><a href="http://localhost:9010/" target="_blank">Demo (Greeting App)</a></p>
</div>
</section>
<section>
<h2>Externals</h2>
</section>
<section>
<h3>Externals</h3>
<p>Allgemeine Bibliotheken können von CDNs geladen werden und landen nicht im Webpack build</p>
<p>Vorteil: Caching (sowohl im Browser als auch in mittleren Schichten), mehrere parallele Requests</p>
<pre><code class="javascript" data-trim>
externals: {
"react": "React",
"react-dom": "ReactDOM",
"prop-types": "PropTypes",
"d3": "d3",
"nvd3": "nv"
}
</code></pre>
</section>
<section>
<h3>Dev-Build Größe: Ohne Optimierungen</h3>
<img src="images/screenshot-dist-dev.png">
</section>
<section>
<h3>Prod-Build Größe #1: Mit allen Abhängigkeiten</h3>
<img src="images/screenshot-dist-prod.png">
</section>
<section>
<h3>Prod-Build Größe #2: Ohne React</h3>
<img src="images/screenshot-dist-no-react.png">
</section>
<section>
<h3>Prod-Build Größe #3: Ohne externe Abhängigkeiten (D3, NVD3)</h3>
<img src="images/screenshot-dist-minimal.png">
</section>
<section>
<h3>React <span class="highlight">16</span> vs React <span class="highlight">15</span></h3>
<img src="images/screenshot-react-from-cdn.png">
<p style="font-size:60%">
(<a href="https://facebook.github.io/react/blog/2017/09/26/react-v16.0.html#reduced-file-size"
target="_blank">https://facebook.github.io/react/blog/2017/09/26/react-v16.0.html#reduced-file-size</a>)
</p>
</section>
<section id="universal" class="step-subtitle">
<h2>Optimierungen (3)</h2>
<h1>Universal Rendering</h1>
</section>
<section>
<h3>Probleme von Single-Page Applications</h3>
<ul class="fragment">
<li>SEO
<li>First-Page-Impressions
<li>Preview, z.B.
<ul>
<li>bei der Vorschau von Suchergebnissen
<li> oder dem Teilen von Links durch Social Media
</ul>
</li>
<!--<li>Progressive Enhancement-->
</ul>
</section>
<section>
<h3>SPA: First-Page-Impression</h3>
<div>
<a href="code/architecture/spa/public/index.html" target="_blank">
<img src="images/spa-first-page-impression.png" style="height: 500px;">
</a>
</div>
<p><small>Selbst für eine einfache Web Application kann das Laden und das Aufbauen der Anwendung einige Zeit kosten
und was vom Sever kommt ist eine leere Seite</small></p>
</section>
<section>
<h3>Universal Rendering: First-Page-Impression</h3>
<div>
<a href="http://localhost:3001/" target="_blank">
<img src="images/universal-first-page-impression.png" style="height: 500px;">
</a>
</div>
</section>
<section>
<h3>Universal Rendering</h3>
<ul class="fragment">
<li>First-Page-Impression wird auf dem Server gerendert
<li>Links werden als normale HTML-Links in die Seite gerendert
<li>Beliebig viele andere Seiten werden ebenfalls statisch gerendert
<li>Läuft dann (zumindest zum Teil) auch ohne JavaScript
<li>Code fast 100% geteilt zwischen Client und Server
<li>serverseitiges Rendering mit <a href="https://nodejs.org" target="_blank">https://nodejs.org</a>
<li>Neben Markup liefert der Browser ebenso Zustand
<li>Wird von React unterstützt (in 16 sogar schnell)
</ul>
</section>
<section>
<h3>Universal Rendering in React</h3>
<div class="fragment">
<img src="images/universal.png" style="height: 500px;">
<p><small><a target="_blank" href="http://reactbuch.de/">Copyright 2016, D-Punkt, http://reactbuch.de/</a></small></p>
</div>
</section>
<section>
<h3>Wie transferieren wir den Zustand vom Server zum Client?</h3>
<pre class="fragment"><code data-trim contenteditable class="javascript line-numbers">
<!-- server -->
function renderFullPage(html, initialData) {
return `
<html>
<body>
<div id="mount">${html}</div>
</body>
<script>
window.__INITIAL_STATE__ = ${JSON.stringify(initialData)};
</script>
</html>
`;
}</code></pre>
<pre class="fragment"><code data-trim contenteditable class="javascript line-numbers" data-leftpad>
// client: init store from complete state
const initialState = window.__INITIAL_STATE__;
const store = createStore(..., initialState);
</code></pre>
</section>
<section>
<a target="_blank"
href="https://twitter.com/mxstbr/status/776812185276284928">
<img src="images/twitter_universal.png">
</a>
</section>
<section>
<h3>Herausforderungen / Schwächen</h3>
<ul class="fragment">
<li>Aller Zustand muss beim serverseitigen Rendering komplett vorliegen (oder man rendert statische Platzhalter)
<li>Falls First Page Impression ungültig: Flackern bei Neurendering im Client
<ul>
<li>Unterschiedliche Locales auf Server und Client
<li>Zeitliche veränderliche Daten (Timestamp, Börsenkurs)
</ul>
</li>
<li>Auch auf dem Server muss JavaScript laufen (zumindest für das Rendering Layer)
<li>Hilft nur bei "Time to first Meaningful Paint", nicht bei "Time to Interactive"
</ul>
</section>
<section>
<h2>Geschafft ;-)</h2>
<h3>Vielen Dank für Eure Aufmerksamkeit!</h3>
<h3><b><em>Fragen ?</em></b></h3>
<p>
<a href="http://nilshartmann.net">Nils Hartmann</a> / <a href="http://twitter.com/nilshartmann">@nilshartmann</a>
</p>
<p>
<a href="http://zeigermann.eu">Oliver Zeigermann</a> / <a href="http://twitter.com/djcordhose">@DJCordhose</a>
</p>
</section>
</div>
</div>
<script src="reveal.js/lib/js/head.min.js"></script>
<script src="reveal.js/js/reveal.js"></script>
<script src="lib/jquery-2.2.4.js"></script>
<script>
if (window.location.hostname.indexOf('localhost') !== -1) {
} else {
// only applies to public version
$('.preparation').remove();
}
Reveal.addEventListener( 'ready', function( event ) {
if (window.location.hostname.indexOf('localhost') !== -1) {
// only applies to presentation version
Reveal.configure({ controls: false });
} else {
// only applies to public version
$('.fragment').removeClass('fragment');
}
// applies to all versions
$('code').addClass('line-numbers');
// $('.fragment').removeClass('fragment');
} );
</script>
<script>
// Full list of configuration options available at:
// https://github.com/hakimel/reveal.js#configuration
Reveal.initialize({
controls: true,
progress: true,
history: true,
center: true,
transition: 'slide', // none/fade/slide/convex/concave/zoom
// Optional reveal.js plugins
dependencies: [
{
src: 'reveal.js/lib/js/classList.js', condition: function () {
return !document.body.classList;
}
},
{
src: 'reveal.js/plugin/markdown/marked.js', condition: function () {
return !!document.querySelector('[data-markdown]');
}
},
{
src: 'reveal.js/plugin/markdown/markdown.js', condition: function () {
return !!document.querySelector('[data-markdown]');
}
},
{
src: 'reveal.js/plugin/highlight/highlight.js', async: true, condition: function () {
return !!document.querySelector('pre code');
}, callback: function () {
hljs.initHighlightingOnLoad();
}
},
{src: 'reveal.js/plugin/zoom-js/zoom.js', async: true},
{src: 'reveal.js/plugin/notes/notes.js', async: true},
{src: 'lib/js/line-numbers.js'}
]
});
</script>
</body>
</html>