-
Notifications
You must be signed in to change notification settings - Fork 9
/
Gruntfile.js
106 lines (97 loc) · 2.47 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
'use strict';
/*global require:true, module:true */
module.exports = function (grunt) {
// load all grunt tasks
require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks);
// Project configuration.
grunt.initConfig({
pkg: '<json:package.json>',
jshint: {
options: {
laxcomma: true,
laxbreak: true,
asi: true,
browser: true,
globals: {
jQuery: true
}
},
files: ['source/assets/js/main.js']
},
copy: {
app: {
files: [
{expand: true, cwd: 'source/static', src: ['**'], dest: 'deploy/'},
{expand: true, cwd: 'source/assets', src: ['**'], dest: 'deploy/'},
{expand: true, cwd: 'data', src: ['**'], dest: 'deploy/data/'}
]
}
},
jade: {
compile: {
options: {
data: {
debug: true
}
},
files: {
'deploy/index.html': 'source/templates/index.jade',
'deploy/404.html': 'source/templates/404.jade'
}
}
},
uglify: {
options: {
mangle: false
},
app: {
src: ['source/assets/js/main.js',
'source/assets/js/jquery.tablesorter.js'],
dest: 'deploy/js/scripts.min.js'
}
},
cssmin: {
'deploy/css/style.min.css': [
'source/assets/css/app.css'
]
},
concat: {
js: {
src: ['source/assets/js/main.js',
'source/assets/js/jquery.tablesorter.js'],
dest: 'deploy/js/scripts.min.js'
},
css: {
src: ['source/assets/css/app.css'],
dest: 'deploy/css/style.min.css'
}
},
watch: {
files: '<config:jshint.files>',
tasks: 'jshint concat'
},
clean: {
deploy: ['deploy']
},
jsonlint: {
data: {
src: [ 'data/sources.json' ]
}
},
'gh-pages': {
options: {
base: 'deploy',
message: 'Auto-generated gh-pages update'
},
src: ['**']
}
});
// run everything and minify
grunt.registerTask('default', ['jsonlint', 'jshint', 'jade', 'cssmin', 'uglify', 'concat', 'copy']);
// clean deploy folder
grunt.registerTask('clean', 'clean');
// check that data sources file is valid json
grunt.registerTask('test', 'jsonlint');
// deploy to gh-pages, but make sure everything is built first
grunt.registerTask('deploy', ['jsonlint', 'jshint', 'jade', 'cssmin', 'uglify', 'concat', 'copy', 'gh-pages']);
};