forked from hakimel/reveal.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
grunt.html
288 lines (243 loc) · 7.31 KB
/
grunt.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
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Grunt JS, budapest.js, 25/11/2013</title>
<meta name="description" content="Slides for my lightning talk about Grunt.js at budapest.js, 25/11/2013">
<meta name="author" content="Jozsef Kozma">
<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.min.css">
<link rel="stylesheet" href="css/theme/solarized.css" id="theme">
<!-- For syntax highlighting -->
<link rel="stylesheet" href="lib/css/zenburn.css">
<!-- If the query includes 'print-pdf', use the PDF print sheet -->
<script>
document.write( '<link rel="stylesheet" href="css/print/' + ( window.location.search.match( /print-pdf/gi ) ? 'pdf' : 'paper' ) + '.css" type="text/css" media="print">' );
</script>
<!--[if lt IE 9]>
<script src="lib/js/html5shiv.js"></script>
<![endif]-->
</head>
<body>
<div class="reveal">
<div class="slides">
<section>
<h1>Kinja</h1>
<p>
The platform behind Cink, Gizmodo, io9 & Lifehacker
</p>
<p>
Server-side: play.scala, closure-templates.soy
</p>
<p>
Client-side: backbone.js, require.js, closure-templates.js, foundation.scss
</p>
</section>
<section>
<h2>20 deploys a day</h2>
<ul>
<li>fully automated after a Git push</li>
<li>build & deploy by Jenkins took 12 minutes</li>
<li>downside: deployment needed a full JVM restart</li>
</ul>
</section>
<section>
<h2>Lots of frontend changes</h2>
<p>
80% of changesets didn't change .scala at all
</p>
<p>
JVM restart is an overkill
</p>
</section>
<section>
<h2>So we changed it</h2>
<p>
80% of our changesets are live in <a href="http://tech.kinja.com/avoiding-jvm-restarts-when-doing-asset-only-deploys-1458697546">2 minutes</a> now
</p>
</section>
<section>
<h2>
SBT.tasks.moveto(Grunt)
</h2>
<ul>
<li>no need to use Play! this way</li>
<li>our SBT knowledge is kind of limited</li>
<li>our frontend team is full of JS devs</li>
<li>had good experiences with Grunt already</li>
</ul>
</section>
<section>
<section>
<h2>Grunt is great</h2>
<ul>
<li>Grunt is the JS task runner</li>
<li>"there's a task for that"</li>
<li>"there's an API"</li>
</ul>
</section>
<section>
<h2>An example</h2>
<pre><code data-trim contenteditable>
module.exports = function (grunt) {
'use strict';
# configuration happens here
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
jshint: {
options: {
jshintrc: '.jshintrc',
reporter: require('jshint-stylish'),
force: true
},
# this is the task jshint:dev
dev: {
src: [
'public/javascripts/**/*.js'
]
},
# this is the task jshint:build
build: {
options: {
reporter: 'jslint',
reporterOutput: 'target/grunt/contrib-jshint.xml'
},
src: [
'public/javascripts/**/*.js',
'!public/javascripts/generated/**/*.js'
]
}
},
# watch can run tasks whenever a file is changed, very
# useful during development
watch: {
jshint: {
# these are the files being watched
files: [
'public/javascripts/**/*.js'
],
# the task to run on any change
tasks: [
'jshint:dev'
],
options: {
spawn: false
}
}
},
# this task will copy any *.css to filename-{md5}.css
md5: {
compile: {
files: [
{
src: 'stylesheets/**/*.css',
dest: 'stylesheets'
}
],
options: {
encoding: null,
keepBasename: true,
keepExtension: true
}
}
}
});
# on a watch:jshint event we want to jshint that very file only
grunt.event.on('watch', function (action, filePath, target) {
if (target === 'jshint') {
grunt.config('jshint.dev.src', filePath);
}
});
# load all installed grunt tasks
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-md5');
# calling grunt without a task specified will run
# jshint:build and then md5
grunt.registerTask('default', [
'jshint:build',
'md5'
]);
};
</code></pre>
</section>
<section>
<h2>Usage</h2>
<pre><code data-trim contenteditable>
# will run a build
grunt
# will run jshint on all JS files
grunt jshint:dev
# will start grunt watch
grunt watch
</code></pre>
</section>
</section>
<section>
<h2>During development</h2>
<p>
Grunt Watch is used for
<ul>
<li>.soy to .js transforms</li>
<li>.scss to .css transforms</li>
<li>JSHinting</li>
</ul>
</section>
<section>
<h2>During a build</h2>
<p>
Series of tasks are run against our code
<ul>
<li>Code quality checks (JSHint, JSComplexity)</li>
<li>.scss to .css transforms</li>
<li>.soy to .js transforms</li>
<li>generating .js source</li>
<li>requirejs</li>
<li>uglify</li>
<li>md5</li>
</ul>
</section>
<section>
<h2>Interested?</h2>
<ul>
<li>Check Grunt API, it's great</li>
<li><a href="http://tech.kinja.com/handling-500-lines-of-gruntfile-js-1470211529">explode</a> your Gruntfile.js and DRY your config</li>
<li><a href="http://tech.kinja.com/handling-500-lines-of-gruntfile-js-1470211529">see others</a> too</li>
</ul>
</section>
<section>
<h1>EOM</h1>
<h3>Obviously, we're hiring</h3>
<p>
mailto:joco@gawker.com
</p>
</section>
</div>
</div>
<script src="lib/js/head.min.js"></script>
<script src="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/fade/none
// 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; } }
]
});
</script>
</body>
</html>