-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
executable file
·648 lines (525 loc) · 21.3 KB
/
index.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
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
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Javascript Build System Showdown</title>
<meta name="description" content="A framework for easily creating beautiful presentations using HTML">
<meta name="author" content="Hakim El Hattab">
<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="css/reveal.css">
<link rel="stylesheet" href="css/theme/default.css" id="theme">
<!-- For syntax highlighting -->
<link rel="stylesheet" href="lib/css/zenburn.css">
<!-- If the query includes 'print-pdf', include the PDF print sheet -->
<script>
if( window.location.search.match( /print-pdf/gi ) ) {
var link = document.createElement( 'link' );
link.rel = 'stylesheet';
link.type = 'text/css';
link.href = 'css/print/pdf.css';
document.getElementsByTagName( 'head' )[0].appendChild( link );
}
</script>
<style type="text/css">
/*.reveal .state-background {
background-image: url(https://s3.amazonaws.com/uploads.hipchat.com/41403/429435/YgVwok4JIb4sHUr/grunt-slide-idea.jpg);
background-repeat: no-repeat;
background-color: #262A2D;
background-size: 100%;
}*/
ul.automate {
float: left;
width: 40%;
list-style-type: none !important;
}
ul.automate:first {
margin-left: 20%;
}
.grunt_orange {
color: #e48632;
}
.reveal pre {
font-size: 1.1em !important;
}
#edit_changes {
color: #4C2CC0;
margin: 5px;
padding: 30px;
font-size: 1.3em;
border-radius: 15px;
box-shadow: 2px 2px #e48632;
outline: 0;
}
#code_highlight {
position: fixed;
top: 0;
left: 0;
height: 100%;
width: 100%;
z-index: 1000;
}
#code_highlight pre, #code_highlight code {
height: 100%;
width: 100%;
font-size: 1.5em;
overflow: auto;
}
</style>
<!--[if lt IE 9]>
<script src="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">
<section data-background="css/js-highlight.png" style="height: 100%; width: 100%;" data-background-repeat="no-repeat" data-background-position="0 0">
<img src="lib/img/sponsors.png" />
</section>
<section data-background="css/js-highlight.png" data-background-repeat="no-repeat" data-background-position="0 0">
<h1>Javascript Build System Showdown</h1>
<h3></h3>
<p>
<small>Created by <a href="http://jbavari.github.io">Josh Bavari</a> / <a href="http://twitter.com/jbavari">@jbavari</a></small>
</p>
</section>
<section data-background="css/js-faded.png" data-background-repeat="no-repeat" data-background-position="0 0">
<h2>What this talk is about</h2>
<ul>
<li>Understanding issues facing web development</li>
<li>Understanding issues facing Nodejs development</li>
<li>General derp issues facing Javascript development</li>
<li>Solutions for solving above issues</li>
</ul>
</section>
<section>
<h2>First off - why?</h2>
<ul>
<li>You write a lot of Javascript</li>
<li>You want to concat/minify assets</li>
<li>You want to remove unused CSS</li>
<li>You NEED to eliminate (boring) manual tasks</li>
<li>You want to lint, test & deploy code</li>
<li>You want browser to auto-refresh when you modify files</li>
</ul>
<aside class="notes">
Most development environments have had build system in place for a while. For visual studio, it relies on MSBuild under the covers to pull assets together and compile binaries. In the Java world, you've got ant that runs around from its xml file and puts things into place. In Ruby land, we have rake files to instruct rake on what to do and how to do it. Javascript has only recently gotten mature tools equal to the other development stacks.
</aside>
</section>
<section>
<h2>Second, a story</h2>
<ul>
<li>First began mobile Phonegap app on iOS / Android - early 2012</li>
<li>Purely HTML/Javascript with some native code</li>
<li>Build/release cycle was rough</li>
<li>Processes - manual. Not fun & tons of errors</li>
</ul>
<aside class="notes">
My own personal background has been manual hammer first attacks at Javascript tasks. Then moved back into the stone age and shell scripts for calling linters, copying code around, and calling other programs. I needed a central tool to handle all of this for me instead of myself running tasks that I am bound to fat finger and mistake something. That and our build process was copy/pasting in keys/ids/urls, much error prone. Our releases to apple become more and more buggy, as well as our actual apps being plagued with bugs. We needed something to take the manual tasks and automate them away.
</aside>
</section>
<section>
<img src="css/giveup.gif" />
</section>
<section>
<h2>Then, Evolution!</h2>
<ul>
<li>Began to seek out better tools, processes, & methodologies</li>
<li>Started with basic shell scripts to orchestrate</li>
<li>Found Grunt, began to automate boring mundane tasks, lint code, run tests, compile sass, & deploy code</li>
</ul>
</section>
<section>
<h2>Data & errors arent cheap</h2>
<ul>
<li>Preprocess items - LESS/SASS/CoffeeScript</li>
<li>Lint code, Run tests</li>
<li>Minify assets - HTML/CSS/JS/Images</li>
<li>Deploy to CDN / Staging / Prod</li>
</ul>
</section>
<section>
<h2>Definition: build system</h2>
<ul>
<li>Build system = series of task exec in order</li>
<li>Javascript tools call themselves task runners</li>
<li>Let build system == task runners</li>
</ul>
<aside class="notes">
Lets call a build system a series of tasks executed in a certain order. Javascript tools call themselves task runners, so lets use build systems interchangibly. Build systems are mainly concerned with handling the preprocessing, concat/minifying, testing, and release processes.
</aside>
</section>
<section>
<h1>Put up or shut up</h1>
<p>Demo time!</p>
<aside class="notes">
Showing code/demo of Gruntfile.js located in root directory, then code/demo of Gulpfile.js in root dir, then broccoli commands, followed by brunch commands.
</aside>
</section>
<section>
<h2>Your reaction</h2>
<img class="centeredPic" src="css/clap.gif">
</section>
<section>
<h2>You're using a build system now</h2>
<ul>
<li>Visual Studio (MSBuild)</li>
<li>Apache Ant</li>
<li>GNU Make</li>
<li>Ruby Make (Rake)</li>
</ul>
</section>
<section>
<h2>Prereqs</h2>
<ul>
<li>Node</li>
<li>npm</li>
<li>package.json - specifying packages</li>
</ul>
</section>
<section>
<h2>Current Javascript build tools</h2>
<ul>
<li><a href="http://gruntjs.com/">Grunt.js</a></li>
<li><a href="http://gulpjs.com/">Gulp.js</a></li>
<li><a href="https://github.com/broccolijs/broccoli">Broccoli</a></li>
<li><a href="http://brunch.io/">Brunch</a></li>
</ul>
</section>
<section>
<h2>Why so many?</h2>
<p>
Think the systems all being tools in a toolshed. Each tool is used differently. Some focused on strictly atomic tasks. Others focused on one pass through. No tool is wrong, just different approaches.
</p>
</section>
<section>
<h3>Maturity of projects</h3>
<ul>
<li>Brunch - Jan 2011, very mature</li>
<li>Grunt.js - Mar 2012, very mature</li>
<li>Gulp.js - ~ Aug 2013, relatively mature</li>
<li>Broccoli - Feb 2014, still in beta</li>
</ul>
</section>
<section>
<h2>Community Support</h2>
<ul>
<li>Grunt has the most popularity</li>
<li>Gulp is the newer kid on the block. Picking up popularity</li>
<li>Brunch, fairly new, plenty of plugins & skeletons</li>
<li>Broccoli - in beta, have plugins available</li>
</ul>
</section>
<section>
<h2>Grunt / Gulp interoperability</h2>
<p>
Grunt has a plugin to run Gulp tasks, and Gulp has a plugin to run Grunt tasks.
</p>
</section>
<section>
<h2>Which tool for the task at hand?</h2>
<p>
Each tool has strengths and weaknesses. Your job will be to identify which tool may be best suited for your needs.
</p>
</section>
<section data-background="css/grunt-faded.png" data-background-repeat="no-repeat" data-background-position="0 0">
<section data-background="css/grunt-highlight.png" data-background-repeat="no-repeat" data-background-position="0 0">
<h2>Grunt.js</h2>
</section>
<section>
<h2>Getting started</h2>
<pre><code class="javascript" data-trim contenteditable style="font-size: 18px;">
//Install grunt command line tools
npm install -g grunt-cli
//Specify plugins by saving to package.json file
npm install grunt-contrib-uglify --save-dev
npm install grunt-contrib-concat --save-dev
</code></pre>
<button class="code_enlarge">Enlarge</button>
</section>
<section>
<h2>Gruntfile Configuration</h2>
<pre><code class="javascript" data-trim contenteditable style="font-size: 18px;">
grunt.initConfig({
our_file_list: ['./src/js/{Models,Controllers}/*.js', './src/js/index.js'],
uglify: {
build: {
src: 'js/reveal.js',
dest: 'js/reveal.min.js'
},
all: {
files: {
'js/compiled/file.js': '<%= our_file_list %>',
}
}
},
concat: {
dist: {
src: ['js/reveal.min.js', 'js/compiled/file.js'],
dest: 'dist/built.js',
},
}
});
</code></pre>
<button class="code_enlarge">Enlarge</button>
</section>
<section>
<h2>Plugins via package.json</h2>
<pre><code class="javascript" data-trim contenteditable style="font-size: 18px;">
{
"name": "my-project-name",
"version": "0.1.0",
"devDependencies": {
"grunt": "~0.4.5",
"grunt-contrib-jshint": "~0.10.0",
"grunt-contrib-nodeunit": "~0.3.3",
"grunt-contrib-uglify": "~0.4.0"
}
}
</code></pre>
<button class="code_enlarge">Enlarge</button>
</section>
<section>
<h2>Command Line Usage</h2>
<pre><code class="javascript" data-trim contenteditable style="font-size: 18px;">
//Run all uglify targets
grunt uglify
//Execute uglify, but only the all target
grunt uglify:all
</code></pre>
<button class="code_enlarge">Enlarge</button>
</section>
<section >
<h2>Grunt.js - strengths</h2>
<ul>
<li>Tons of plugins available</li>
<li>Easy to configure individual tasks</li>
<li>Easy to use with existing projects</li>
<li>Very flexible - allows custom tasks to be written</li>
<li>Comes pre-packaged in some generators/scaffolding</li>
</ul>
</section>
<section>
<h2>Grunt.js - weaknesses</h2>
<ul>
<li>Plugins do multiple things</li>
<li>Headache of temp files/folders</li>
<li>Not one solid control flow</li>
<li>Configuration can get lengthy - 500+ lines</li>
<li>Very lengthy & vast API</li>
</ul>
</section>
<section>
<h2>Grunt.js - annoyances</h2>
<ul>
<li>Tons and tons of temp files & tasks to clean up</li>
<li>Can get pretty slow when tasks increase</li>
</ul>
</section>
</section>
<section data-background="css/gulp-faded.png" data-background-repeat="no-repeat" data-background-position="0 0">
<section data-background="css/gulp-highlight.png" data-background-repeat="no-repeat" data-background-position="0 0">
<h2>Gulp.js</h2>
</section>
<section>
<h2>Getting started</h2>
<pre><code class="javascript" data-trim contenteditable style="font-size: 18px;">
//Install grunt command line tools
npm install -g gulp
//Specify plugins by saving to package.json file
npm install --save-dev gulp-uglify
npm install --save-dev gulp-concat
</code></pre>
<button class="code_enlarge">Enlarge</button>
</section>
<section>
<h2>gulpfile Configuration</h2>
<pre><code class="javascript" data-trim contenteditable style="font-size: 18px;">
var gulp = require('gulp');
var concat = require('gulp-concat');
var uglify = require('gulp-uglify');
gulp.task('scripts', function() {
// Minify and copy all JavaScript (except vendor scripts)
return gulp.src(paths.scripts)
.pipe(uglify())
.pipe(concat('all.min.js'))
.pipe(gulp.dest('build/js'));
});
</code></pre>
<button class="code_enlarge">Enlarge</button>
</section>
<section>
<h2>Command Line Usage</h2>
<pre><code class="javascript" data-trim contenteditable style="font-size: 18px;">
//Run all uglify targets
gulp scripts
</code></pre>
<button class="code_enlarge">Enlarge</button>
</section>
<section>
<h2>Gulp.js - strengths</h2>
<ul>
<li>Provides node streams - no need for tmp files/folders</li>
<li>Tons of plugins available</li>
<li>Gulpfile is code, not config</li>
<li>Plugins do ONE thing</li>
<li>Only has 5 functions to learn!</li>
</ul>
</section>
<section>
<h2>Gulp.js - weaknesses</h2>
<ul>
<li>Can be daunting to learn streams</li>
<li>Sometimes setting up src/dest can be tricky (use base)</li>
</ul>
</section>
<section>
<h2>Gulp.js - annoyances</h2>
<p>Havent used long enough to form any</p>
</section>
</section>
<section data-background="css/brunch-faded.png" data-background-repeat="no-repeat" data-background-position="0 0">
<section data-background="css/brunch-highlight.png" data-background-repeat="no-repeat" data-background-position="0 0">
<h2>Brunch</h2>
<p>
The first build system widely used and available. Uses skeletons (like scaffolding) to create app directory structure.
</p>
</section>
<section>
<h2>Getting started</h2>
<pre><code class="javascript" data-trim contenteditable style="font-size: 18px;">
//Create new skeleton of angular app
brunch new https://github.com/scotch/angular-brunch-seed myapp
//Install bower packages (css/js/etc)
bower install
//tell Brunch to watch your project and incrementally rebuild it when source files are changed
brunch watch --server
//builds a project for distribution. By default it enables minification
brunch build --production
</code></pre>
<button class="code_enlarge">Enlarge</button>
</section>
<section>
<h2>Brunch - strengths</h2>
<ul>
<li>Easy to set up - use skeleton</li>
<li>Introduces conventions for you</li>
<li>Simple CLI - only a few commands</li>
<li>Commands for dev/staging/production releases</li>
</ul>
</section>
<section>
<h2>Brunch - weaknesses</h2>
<ul>
<li>Not using conventions causes headaches</li>
<li>Not easy to set up with existing projects</li>
<li>Skeleton set ups not maintained as fast as plugins</li>
<li>Not as supported as Grunt/Gulp</li>
</ul>
</section>
</section>
<section data-background="css/broccoli-faded.png" data-background-repeat="no-repeat" data-background-position="0 0">
<section data-background="css/broccoli-highlight.png" data-background-repeat="no-repeat" data-background-position="0 0">
<h2>Broccoli</h2>
<p>Mainly focused on Ember.js apps, and ships with Ember CLI</p>
</section>
<section>
<h2>Broccoli - strengths</h2>
<ul>
<li>Trees allow dev to think of assets</li>
<li>Provides caching for map files</li>
<li>Makes some conventions for you - assets</li>
<li>Watching files handled by serve, only rebuilds whats needed</li>
</ul>
</section>
<section>
<h2>Broccoli - weaknesses</h2>
<ul>
<li>No parallelism</li>
</ul>
</section>
</section>
<section>
<h2>Choosing YOUR build strategy</h2>
<ul>
<li>If you need tons of plugins, stick with Grunt or Gulp</li>
<li>If you need utter speed, go with Gulp</li>
<li>If you want conventions, go with Brunch</li>
<li>If you're an Ember fan, go with Broccoli (tied into Ember CLI)</li>
</ul>
</section>
<section>
<h2>References</h2>
<ul>
<li><a href="http://chariotsolutions.com/blog/post/grunt-javascript-centric-build-tool/">Grunt - a Javascript-centric build tool</a></li>
<li><a href="http://24ways.org/2013/grunt-is-not-weird-and-hard/">Grunt for People Who Think Things Like Grunt are Weird and Hard</a></li>
<li><a href="http://slides.com/contra/gulp">Gulp - the streaming build system (slides)</a></li>
<li><a href="http://www.sitepoint.com/introduction-gulp-js/">Introduction to Gulp.js (Gulp vs Grunt)</a></li>
<li><a href="http://alxhill.com/blog/articles/brunch-coffeescript-angular/">Brunch - A build system without the Grunt-work</a></li>
<li><a href="http://blog.toggl.com/2014/03/grunt-vs-gulp-vs-brunch/">Grunt vs gulp vs brunch</a></li>
<li><a href="http://www.solitr.com/blog/2014/02/broccoli-first-release/">Broccoli: First Beta Release</a></li>
<li><a href="http://ampersate.com/getting-started-with-broccoli-and-emberjs">Getting started with Broccoli and Ember.js</a></li>
<li><a href="http://www.confreaks.com/videos/3301-emberconf2014-no-more-grunt-watch-modern-build-workflows-with-broccoli">Ember Conf - No more `grunt watch`: Modern build workflows with Broccoli</a></li>
<li><a href="http://www.octolabs.com/blogs/octoblog/2014/05/10/ember-cli-broccoli-bootstrap-sass-part-2/">Ember-cli, broccoli, bootstrap & sass : Part 2</a></li>
<li><a href="https://gist.github.com/callumacrae/9231589">Gist of Javascript build tools</a></li>
<li><a href="https://github.com/gulpjs/plugins/commit/0dbaa9eba2ff423f0e1b5785c43c2c20bda9a879">Proof of gulpjs plugin site using brunch, grunt, & gulp</a></li>
</ul>
</section>
</div>
</div>
<script src="lib/js/head.min.js"></script>
<script src="js/reveal.min.js"></script>
<script src="js/jquery.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 || 'default', // default/cube/page/concave/zoom/linear/fade/none
// Parallax scrolling
// parallaxBackgroundImage: 'https://s3.amazonaws.com/hakim-static/reveal-js/reveal-parallax-1.jpg',
// parallaxBackgroundSize: '2100px 900px',
// Optional libraries used to extend on reveal.js
dependencies: [
{ src: 'lib/js/classList.js', condition: function() { return !document.body.classList; } },
{ src: 'plugin/markdown/marked.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } },
{ src: 'plugin/markdown/markdown.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } },
{ src: 'plugin/highlight/highlight.js', async: true, callback: function() { hljs.initHighlightingOnLoad(); } },
{ src: 'plugin/zoom-js/zoom.js', async: true, condition: function() { return !!document.body.classList; } },
{ src: 'plugin/notes/notes.js', async: true, condition: function() { return !!document.body.classList; } }
]
});
var codeHighlight = false;
$(function(){
$(document).on("click", ".code_enlarge", function(e) {
var code = $(this).parent().find("code");
$("#code_highlight").css("display", "block");
$("#code_highlight").find("code").text(code.text());
codeHighlight = true;
hljs.highlightBlock($("#code_highlight").find("code")[0]);
e.preventDefault();
return false;
});
$(document).on("click", "#code_close", function(e){
if(codeHighlight) {
$("#code_highlight").css("display", "none");
codeHighlight = false;
}
e.preventDefault();
return false;
});
})
</script>
<div id="code_highlight" style="display: none">
<pre><code data-trim contenteditable>
</code></pre>
<button id="code_close" style="position: absolute; top: 0; right: 100px;">Close</button>
</div>
</body>
</html>