-
Notifications
You must be signed in to change notification settings - Fork 0
/
gruntfile.js
175 lines (171 loc) · 3.79 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
module.exports = function(grunt) {
grunt.initConfig({
copy: {
svgs: {
expand: true,
cwd: 'src',
src: '*.svg',
dest: 'dist/'
},
pngs: {
expand: true,
cwd: 'src',
src: '*.png',
dest: 'dist/'
},
vars: {
files: {
'dist/vars.js': 'src/vars.js',
}
}
},
htmlmin: {
main: {
options: {
removeComments: true,
collapseWhitespace: true
},
files: {
'dist/index.html': 'src/index.html',
'dist/picker.html': 'src/picker.html',
'dist/floor.html': 'src/floor.html',
'dist/tower.html': 'src/tower.html',
'dist/error.html': 'src/error.html',
'dist/home.html': 'src/home.html',
'dist/about.html': 'src/about.html',
}
}
},
uglify: {
base: {
options: {
preserveComments: /(?:^!|@(?:preserve))/
},
files: {
'dist/base.js': ['src/base.js'],
'dist/links.js': ['src/links.js'],
}
}
},
less: {
main: {
options: {
compress: true
},
files: {
'dist/index.css':'src/index.less',
'dist/picker.css':'src/picker.less',
'dist/floor.css':'src/floor.less',
'dist/base.css':'src/base.less',
'dist/home.css':'src/home.less',
'dist/about.css':'src/about.less',
}
}
},
postcss: {
options: {
processors: [require('autoprefixer')()]
},
dist: {
src: 'dist/*.css'
}
},
cssmin: {
main: {
options: {
removeComments: true,
collapseWhitespace: true
},
files: {
'dist/index.css': 'dist/index.css',
'dist/picker.css': 'dist/picker.css',
'dist/floor.css': 'dist/floor.css',
'dist/base.css': 'dist/base.css',
'dist/home.css': 'dist/home.css',
'dist/about.css': 'dist/about.css',
}
}
},
inline: {
index: {
options: {
uglify: false
},
src: 'dist/index.html',
dest: 'dist/index.html'
},
picker: {
src: 'dist/picker.html',
dest: 'dist/picker.html'
},
floor: {
src: 'dist/floor.html',
dest: 'dist/floor.html'
},
tower: {
src: 'dist/tower.html',
dest: 'dist/tower.html'
},
error: {
src: 'dist/error.html',
dest: 'dist/error.html'
},
home: {
src: 'dist/home.html',
dest: 'dist/home.html'
},
about: {
src: 'dist/about.html',
dest: 'dist/about.html'
}
},
watch: {
client: {
files: ['src/*.*'],
tasks: ['copy', 'htmlmin', 'uglify', 'less', 'postcss', 'inline', 'rename', 'express:main'],
options: {
spawn: false
}
},
server: {
files: ['server.js'],
tasks: ['express:main'],
options: {
spawn: false
}
}
},
express: {
main: {
options: {
script: 'server.js'
}
}
},
rename: {
main: {
files: [
{src: 'dist/index.html', dest: 'dist/index.mustache'},
{src: 'dist/picker.html', dest: 'dist/picker.mustache'},
{src: 'dist/floor.html', dest: 'dist/floor.mustache'},
{src: 'dist/tower.html', dest: 'dist/tower.mustache'},
{src: 'dist/error.html', dest: 'dist/error.mustache'},
{src: 'dist/home.html', dest: 'dist/home.mustache'},
{src: 'dist/about.html', dest: 'dist/about.mustache'},
]
}
}
});
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-cssmin');
grunt.loadNpmTasks('grunt-contrib-htmlmin');
grunt.loadNpmTasks('grunt-contrib-less');
grunt.loadNpmTasks('grunt-contrib-rename');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-express-server');
grunt.loadNpmTasks('grunt-inline');
grunt.loadNpmTasks('grunt-postcss');
grunt.registerTask('server', ['copy', 'htmlmin', 'uglify', 'less', 'postcss', 'inline', 'rename', 'express', 'watch']);
grunt.registerTask('build', ['copy', 'htmlmin', 'uglify', 'less', 'postcss', 'inline', 'rename']);
};