-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
354 lines (320 loc) · 12 KB
/
index.html
File metadata and controls
354 lines (320 loc) · 12 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
<!doctype html>
<html lang="de">
<head>
<meta charset="utf-8">
<title>Javascript- und CSS-Resourcen-Verwaltung mit grunt.js</title>
<meta name="description" content="grunt.js ist Automationstoo">
<meta name="author" content="Mario Rutz">
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
<link rel="stylesheet" href="../reveal.js/css/reveal.min.css">
<link rel="stylesheet" href="../reveal.js/css/theme/default.css" id="theme">
<link rel="stylesheet" href="css/additional.css">
<!-- For syntax highlighting -->
<link rel="stylesheet" href="../reveal.js/lib/css/zenburn.css">
<!-- If the query includes 'print-pdf', use the PDF print sheet -->
<script>
document.write( '<link rel="stylesheet" href="../reveal.js/css/print/' + ( window.location.search.match( /print-pdf/gi ) ? 'pdf' : 'paper' ) + '.css" type="text/css" media="print">' );
</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">
<section class="intro">
<h2>Javascript- und CSS- <br>Resourcenverwaltung mit</h2>
<h1>grunt.js</h1>
<h4>Mario Rutz</h4>
<h4><a href="http://twitter.com/basis42" target="_new">@basis42</a> --- <a href="http://www.basis42.de" target="_new">http://www.basis42.de</a></h4>
</section>
<section>
<h2>Mario Rutz</h2>
<ul>
<li class="fragment roll-in">Erste Programmiersprache Assembler (6510)</li>
<li class="fragment roll-in">OOP in Java, C++</li>
<li class="fragment roll-in">seit 1999 Webentwickler</li>
<li class="fragment roll-in">PHP Einstieg mit PHP3</li>
<li class="fragment roll-in">Javascript als 2. Sprache</li>
<li class="fragment roll-in">und wenn es mich beißt auch gerne mal wieder Java!</li>
</ul>
</section>
<section>
<h2>Was ist grunt.js?</h2>
<p>Entwickelt wird grunt.js von <a href="http://benalman.com/" target="_new">Ben Alman</a>, die Projektwebsite unter <a href="http://gruntjs.com/">gruntjs.com</a> sagt:</p>
<blockquote>
Grunt is a task-based command line build tool for JavaScript projects
</blockquote>
</section>
<section>
<section>
<h2>Was kann grunt.js für uns tun?</h2>
<p>CSS und Javascript</p>
<ul>
<li class="fragment roll-in">Minifizieren</li>
<li class="fragment roll-in">Concatinieren</li>
<li class="fragment roll-in">Linting</li>
<li class="fragment roll-in">Compilieren von Sass / Scss</li>
<li class="fragment roll-in">Watch auf Dateien und Ordner</li>
<li class="fragment roll-in">Integrierter Webserver</li>
</ul>
</section>
<section>
<h3>... und eine Auswahl an weiteren Tasks:</h3>
<ul>
<li class="fragment roll-in">Handling von minifizierten Resourcen(Versionierung und html Manipuilation)</li>
<li class="fragment roll-in">automatisiertes Testen mit jasmine und phantom.js</li>
<li class="fragment roll-in">Minifizierung von Images</li>
<li class="fragment roll-in">Compilierung von LESS / Compass / CoffeeScript / ...</li>
<li class="fragment roll-in">... alles ist möglich!</li>
</ul>
</section>
</section>
<section>
<section>
<h2>Warum grunt.js?</h2>
<div>
<ul>
<li class="fragment roll-in">Javascript ist für Webentwickler natürliche Sprache</li>
<li class="fragment roll-in">Einfach lesbare Syntax (vgl. z.B. Ant und Rake)</li>
<li class="fragment roll-in">Klassische Frontend-Tasks Out-of-the-box</li>
<li class="fragment roll-in">Sehr flache Lernkurve</li>
<li class="fragment roll-in">Erweiterbar</li>
<li class="fragment roll-in">Gut in bestehenden Projekten einsetzbar</li>
</ul>
</div>
</section>
</section>
<section>
<h2>Installation</h2>
<ul>
<li>grunt.js version >= 0.4 (momentan 0.4.1)</li>
<li>Vorraussetzung ist <a href="http://nodejs.org/">node.js</a> version >= 0.8</li>
</ul>
<pre><code class="bash">mario@ubuntu:~/sudo npm install -g grunt-cli
mario@ubuntu:~/sudo npm install grunt</code></pre>
</section>
<section>
<h2>Projektaufbau<br>
</h2>
<p>besteht im Wesentlichen aus:</p>
<ul>
<li>Gruntfile.js</li>
<li>package.json</li>
</ul>
</section>
<section>
<h2>package.json</h2>
<p>Verwaltung von Dependancies / Plugins via <a href="https://npmjs.org">npm</a></p>
<p>Beispiel package.json:</p>
<pre><code>
{
"name": "Build_example_app",
"version": "0.1.0",
"dependencies": {
"grunt": "~0.4",
"grunt-contrib-watch" : "~0.5",
"grunt-contrib-uglify" : "~0.2",
"grunt-contrib-cssmin" : "~0.4",
"grunt-contrib-sass" : "https://github.com/basis42/grunt-..."
}
}
</code></pre>
</section>
<section>
<section>
<h2>Gruntfile.js</h2>
minimales Beispiel
<pre><code>module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
cssmin : {
compress : {
files : {'../css/all.min.css' : ['../css/all.css']}
}
}
});
grunt.loadNpmTasks('grunt-contrib-cssmin');
grunt.registerTask('default', ['cssmin']);
};</code></pre>
</section>
<section>
<pre><code>mario@ubuntu:~/grunt.js_talk/example/build$ grunt
Running "cssmin:compress" (cssmin) task
File ../css/all.min.css created.
Uncompressed size: 743 bytes.
Compressed size: 244 bytes gzipped (696 bytes minified).
Done, without errors.
mario@ubuntu:~/grunt.js_talk/example/build$</code></pre>
</section>
<section>
<h2>Etwas komplexeres Beispiel</h2>
<pre><code>module.exports = function(grunt) {
grunt.initConfig({
lint : {
files : [ 'grunt.js', '../js/**/*.js' ]
},
watch : {
options : {
livereload : true,
spawn: false
},
css : {
files : ['../css/**/*.scss'],
tasks : ['sass', 'cssmin']
},
js : {
files : ['../js/**/*.js'],
tasks : 'min'
}
},
uglify : {
js : {
files : {'../js/app.min.js' : ['../js/app.min.js']}
}
},
sass : {
scss : {
options : {
debugInfo : true,
lineNumber : true
},
files : {'../css/all.css' : ['../css/main.scss']}
}
},
cssmin : {
compress : {
files : {'../css/all.min.css' : ['../css/all.css']}
}
}
});
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-sass');
grunt.loadNpmTasks('grunt-contrib-cssmin');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadTasks('example-local-plugin/tasks');
grunt.registerTask('default', ['sass', 'cssmin', 'uglify']);
};</code></pre>
</section>
<section>
<pre><code>mario@ubuntu:~/grunt.js_talk/example/build$ grunt
Running "sass:scss" (sass) task
Running "cssmin:compress" (mincss) task
File ../css/all.min.css created.
Uncompressed size: 743 bytes.
Compressed size: 244 bytes gzipped (696 bytes minified).
Running "uglify:js" (uglify) task
File "../js/app.min.js" created.
Uncompressed size: 75 bytes.
Compressed size: 85 bytes gzipped (75 bytes minified).
Done, without errors.
mario@ubuntu:~/grunt.js_talk/example/build$</code></pre>
</section>
</section>
<section>
<h2>Plugins</h2>
<ul>
<li class="fragment roll-in">Lokale Plugins</li>
<li class="fragment roll-in">Plugins via npm</li>
</ul>
</section>
<section>
<section>
<h2>Lokal definiertes Plugin</h2>
<p class="fragment roll-in">
Gruntfile.js:
<pre class="fragment roll-in"><code>// local defined taks
grunt.loadTasks('example-local-plugin/tasks');</code></pre>
</p>
<p class="fragment roll-in">
example-local-plugin/tasks/example.tasks.js:
<pre class="fragment roll-in"><code>'use strict';
module.exports = function(grunt) {
grunt.registerTask('hello', 'Write greeting to console.', function(){
console.log('Hello! This is the hello task!');
});
};</code></pre>
</p>
</section>
<section>
<a href="http://ejohn.org/blog/ecmascript-5-strict-mode-json-and-more/">John Resig - ECMAScript 5 Strict Mode, JSON, and More</a>
<blockquote>
Strict Mode is a new feature in ECMAScript 5 that allows you to place a program, or a function, in a "strict" operating context. This strict context prevents certain actions from being taken and throws more exceptions.
</blockquote>
<blockquote>Strict mode helps out in a couple ways:
<ul>
<li>It catches some common coding bloopers, throwing exceptions.</li>
<li>It prevents, or throws errors, when relatively "unsafe" actions are taken (such as gaining access to the global object).</li>
<li>It disables features that are confusing or poorly thought out.</li>
</ul>
</blockquote>
</section>
</section>
<section>
<h2>Plugins via npm</h2>
<ul>
<li class="fragment roll-in">grunt-contrib-* plugins sind kompatibel zu 0.4</li>
<li class="fragment roll-in"><a href="http://gruntjs.com/" target="new">Verfügbare Plugins</a></li>
</ul>
</section>
<section>
<h2>wo wird grunt.js verwendet?</h2>
<ul>
<li>Großer Teil des jQuery Ecosystems (jquery, qunit, jqueryui, sizzle, ...)</li>
<li>Yeoman</li>
<li>reveal.js</li>
<li>...</li>
</ul>
</section>
<section>
<h2>Alternativen</h2>
<ul>
<li class="fragment roll-in">Ant (Plugins / Erweiterungen sind recht aufwendig einzupflegen, krude Syntax)</li>
<li class="fragment roll-in">Phing (keine Frontend-Tasks Out of the box)</li>
<li class="fragment roll-in">brunch.io (Stärken vor allem in Scaffolding)</li>
<li class="fragment roll-in">jake (sehr wenige Tasks Out of the box)</li>
<li class="fragment roll-in">Weitere</li>
</ul>
</section>
<section>
<section>
<h2>Fragen?</h2>
</section>
<section>
<h2>Links</h2>
<p><a href="http://gruntjs.com/">grunt.js Projektseite</a></p>
<p><a href="http://nodejs.org/">node.js Projektseite</a></p>
<p><a href="https://npmjs.org/">npm - Node Package Manager Projektseite</a></p>
<p><a href="https://github.com/basis42/grunt.js_talk/">Vorgestelle Beispiele auf github.com</a></p>
</section>
</section>
</div>
</div>
<script src="../reveal.js/lib/js/head.min.js"></script>
<script src="../reveal.js/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 || 'default', // default/cube/page/concave/zoom/linear/none
// Optional libraries used to extend on reveal.js
dependencies: [
{ src: '../reveal.js/lib/js/classList.js', condition: function() { return !document.body.classList; } },
{ src: '../reveal.js/plugin/markdown/showdown.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, callback: function() { hljs.initHighlightingOnLoad(); } },
{ src: '../reveal.js/plugin/zoom-js/zoom.js', async: true, condition: function() { return !!document.body.classList; } },
{ src: '../reveal.js/plugin/notes/notes.js', async: true, condition: function() { return !!document.body.classList; } }
// { src: 'plugin/remotes/remotes.js', async: true, condition: function() { return !!document.body.classList; } }
]
});
</script>
</body>
</html>