-
Notifications
You must be signed in to change notification settings - Fork 9
/
gruntfile.js
318 lines (302 loc) · 11.8 KB
/
gruntfile.js
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
module.exports = function(grunt) {
grunt.initConfig({
jablConfig: grunt.file.readJSON('jabl.json'),
jade: {
compile: {
options: {
pretty: true
},
files: [
{
expand: true, // Enable dynamic expansion.
cwd: 'src/jade/public', // Src matches are relative to this path.
src: ['**/*.jade'], // Actual pattern(s) to match.
dest: 'public/', // Destination path prefix.
ext: '.html' // Dest filepaths will have this extension.
}
]
}
},
concat: {
deps: {
src: [
'public/js/<%= jablConfig.appTitle.camelized %>-cs.js',
'public/js/extra.js'
],
dest: 'public/js/<%= jablConfig.appTitle.camelized %>.js'
}
},
uglify: {
options: {
banner: '/*! <%= jablConfig.appTitle.original %> <%= grunt.template.today("dd-mm-yyyy") %> */\n'
},
jid: {
files: {
'public/js/<%= jablConfig.appTitle.camelized %>.min.js': [
'public/js/<%= jablConfig.appTitle.camelized %>.js']
}
}
},
jshint: {
beforeConcat: {
src: ['gruntfile.js', 'src/js/src/<%= jablConfig.appTitle.camelized %>/**/*.js']
},
afterConcat: {
src: [
'public/js/<%= jablConfig.appTitle.camelized %>.js'
]
},
options: {
// options here to override JSHint defaults
globals: {
jQuery: true,
console: true,
module: true,
document: true,
angular: false,
},
reporterOutput: '',
globalstrict: false
}
},
less: {
dev: {
options: {
cleancss: false
},
files: {
"public/css/<%= jablConfig.appTitle.camelized %>.css": "src/less/<%= jablConfig.appTitle.camelized %>.less",
"public/css/bootstrap-lightbox.css": "bower/bootstrap-lightbox/less/bootstrap-lightbox.less"
}
},
prod: {
options: {
cleancss: true,
report: 'min',
optimization: 1
},
files: {
"public/css/<%= jablConfig.appTitle.camelized %>.min.css": "src/less/<%= jablConfig.appTitle.camelized %>.less",
"public/css/bootstrap-lightbox.min.css": "bower/bootstrap-lightbox/less/bootstrap-lightbox.less"
}
},
},
connect: {
server: {
options: {
port: 9000,
base: 'public',
hostname: 'localhost',
keepalive: true,
livereload: true
}
}
},
watch: {
options: {
livereload: true
},
files: [
'gruntfile.js',
'src/**/*'
],
tasks: ['default']
},
modernizr: {
dist: {
// [REQUIRED] Path to the build you're using for development.
"devFile": "node_modules/grunt-modernizr/lib/modernizr-dev.js",
// Path to save out the built file.
"outputFile": "public/js/modernizr-custom.js",
// Based on default settings on http://modernizr.com/download/
"extra": {
"shiv": true,
"printshiv": false,
"load": true,
"mq": false,
"cssclasses": true
},
// Based on default settings on http://modernizr.com/download/
"extensibility": {
"addtest": false,
"prefixed": false,
"teststyles": false,
"testprops": false,
"testallprops": false,
"hasevents": false,
"prefixes": false,
"domprefixes": false,
"cssclassprefix": ""
},
// By default, source is uglified before saving
"uglify": true,
// Define any tests you want to implicitly include.
"tests": [],
// By default, this task will crawl your project for references to Modernizr tests.
// Set to false to disable.
"parseFiles": true,
// When parseFiles = true, this task will crawl all *.js, *.css, *.scss and *.sass files,
// except files that are in node_modules/.
// You can override this by defining a "files" array below.
// "files" : {
// "src": []
// },
// This handler will be passed an array of all the test names passed to the Modernizr API, and will run after the API call has returned
// "handler": function (tests) {},
// When parseFiles = true, matchCommunityTests = true will attempt to
// match user-contributed tests.
"matchCommunityTests": false,
// Have custom Modernizr tests? Add paths to their location here.
"customTests": []
}
},
copy: {
main: {
files: [
// includes files within path
{
expand: true,
nonull: true,
flatten: true,
src: [
'src/img/*.jpg',
'src/img/*.gif',
'src/img/*.png',
'src/img/*.svg',
'bower/blueimp-gallery/img/*.*',
'bower/blueimp-bootstrap-image-gallery/img/*.*'
],
dest: 'public/img/',
filter: 'isFile'
},
{
expand: true,
nonull: true,
flatten: true,
src: ['src/js/*'],
dest: 'public/js/',
filter: 'isFile'
},
{
expand: true,
nonull: true,
flatten: true,
src: ['src/img/favicon.ico', 'src/img/favicon.png'],
dest: 'public/',
filter: 'isFile'
},
]
},
js: {
files: [
{
expand: true,
nonull: true,
flatten: true,
src: [
'bower/bootstrap/dist/js/bootstrap.js',
// 'bower/jquery-scrolldeck/js/jquery-1.8.2.min.js',
// 'bower/jquery-scrolldeck/js/jquery.easing.1.3.js',
// 'bower/jquery-scrolldeck/js/jquery.scrollTo-1.4.3.1.min.js',
// 'bower/jquery-scrolldeck/js/jquery.scrollorama.js',
// 'bower/jquery-scrolldeck/js/jquery.scrolldeck.js',
'bower/bootstrap-lightbox/js/bootstrap-lightbox.js',
'bower/jquery/dist/jquery.min.js',
'bower/jquery/dist/jquery.min.map',
'bower/magnific-popup/dist/*.js',
'bower/ScrollMagic/scrollmagic/uncompressed/ScrollMagic.js',
'bower/ScrollMagic/scrollmagic/uncompressed/plugins/jquery.ScrollMagic.js',
'bower/jquery-scrolldeck/decks/parallax/scripts/jquery.parallax-1.1.js',
'bower/blueimp-bootstrap-image-gallery/js/bootstrap-image-gallery*.js',
'bower/blueimp-gallery/js/blueimp-gallery*.js'
],
dest: 'public/js/',
filter: 'isFile'
},
]
},
css: {
files: [
{
expand: true,
nonull: true,
flatten: true,
src: [
'bower/bootstrap/dist/css/bootstrap*.css',
'bower/bootstrap/dist/css/bootstrap*.map',
'bower/magnific-popup/dist/*.css',
'bower/blueimp-gallery/css/blueimp-gallery*.css',
'bower/blueimp-bootstrap-image-gallery/css/bootstrap-image-gallery*.css'
],
dest: 'public/css/',
filter: 'isFile'
},
]
},
fonts: {
files: [
{
expand: true,
nonull: true,
flatten: true,
src: ['bower/bootstrap/fonts/glyphicons-halflings-regular.woff',
],
dest: 'public/fonts/',
filter: 'isFile'
},
]
}
},
coffee: {
compile: {
options: {
bare: true
},
files: {
'public/js/guake-cs.js': ['src/coffee/guake.coffee'] // compile and concat into single file
}
},
glob_to_multiple: {
expand: true,
flatten: true,
cwd: 'path/to',
src: ['*.coffee'],
dest: 'public/js/',
ext: '.js'
},
},
sitemap: {
dist: {
siteRoot: 'public/',
homepage: 'http://guake.github.io',
changefreq: 'yearly',
},
}
});
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-jade');
grunt.loadNpmTasks('grunt-contrib-less');
grunt.loadNpmTasks('grunt-contrib-connect');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-coffee');
grunt.loadNpmTasks('grunt-sitemap');
grunt.loadNpmTasks("grunt-modernizr");
grunt.registerTask('build', ['jade',
'coffee',
'less',
'copy',
'modernizr',
'sitemap',
'jshint:beforeConcat',
'concat',
'jshint:afterConcat',
'uglify']);
grunt.registerTask('release', ['build', 'uglify']);
grunt.registerTask('dev', ['build']);
grunt.registerTask('default', ['dev']);
grunt.registerTask('serve', ['connect']);
grunt.registerTask('livereload', ['dev', 'watch']);
};