-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgruntfile.js
131 lines (126 loc) · 2.36 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
module.exports = function(grunt) {
'use strict';
var jsfiles = [
'src/StackBlur.js',
'src/font-detect.js',
'src/guid.js',
'src/client.js',
'src/js.js'
];
var cssfiles = [ 'src/css.css' ];
var conf = {
connect: {
src: {
options: {
port: 80,
base: 'src',
keepalive: true
}
},
www: {
options: {
port: 80,
base: 'www',
keepalive: true
}
}
},
uglify: {
options: {
preserveComments: 'some'
},
'prod-test': {
files: {
'src/js.min.js': jsfiles
}
},
'prod-debug': {
files: {
'www/js.min.js': jsfiles
}
},
'prod': {
options: { compress: { drop_console: true }},
files: {
'www/js.min.js': jsfiles
}
}
},
cssmin: {
'prod-test': {
files: {
'src/css.min.css': cssfiles
}
},
'prod': {
files: {
'www/css.min.css': cssfiles
}
}
},
// prod-debug option to run full JS on aws
copy: {
'prod-debug': {
files: [
{
expand: true,
dest: 'www',
cwd: 'src',
src: ['*.js', '*.css', '*.woff', '*.woff2']
}
]
}
},
jade: {
dev: {
options: {
pretty: true,
data: {
env: 'dev'
}
},
files: { 'src/index.html': 'src/index.jade' }
},
'prod-test': {
options: {
data: {
env: 'prod-test'
}
},
files: { 'src/index.html': 'src/index.jade' }
},
'prod-debug': {
options: {
pretty: true,
data: {
env: 'prod-debug'
}
},
files: { 'www/index.html': 'src/index.jade' }
} ,
'prod': {
options: {
data: {
env: 'prod'
}
},
files: { 'www/index.html': 'src/index.jade' }
}
},
clean: ['www']
};
grunt.initConfig(conf);
grunt.loadNpmTasks('grunt-contrib-connect');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-cssmin');
grunt.loadNpmTasks('grunt-contrib-jade');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-clean');
// dev == localhost
grunt.registerTask('dev', ['jade:dev']);
// prod-test == localhost with minified content
grunt.registerTask('prod-test', ['cssmin:prod-test', 'uglify:prod-test', 'jade:prod-test']);
grunt.registerTask('prod-debug', ['copy:prod-debug', 'jade:prod-debug']);
// prod === aws
grunt.registerTask('prod', ['cssmin:prod', 'uglify:prod', 'jade:prod']);
};