This repository has been archived by the owner on Aug 12, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.coffee
201 lines (172 loc) · 3.8 KB
/
Gruntfile.coffee
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
module.exports = (grunt) ->
# load all grunt plugins defined in package.json
require('load-grunt-tasks') grunt
grunt.initConfig
pkg: grunt.file.readJSON("package.json")
concurrent:
dev: [
"jade:dev"
"sass:dev"
"coffee:dev"
"copy"
]
release: [
"jade:release"
"sass:release"
"coffee:release"
"copy"
]
optimize: [
"uglify"
"newer:imagemin"
"inline:release"
]
connect:
options:
base: ["release"]
dev:
options:
keepalive: false
release:
options:
keepalive: true
clean:
dev: ["release"]
release: ["release",]
tmp: [ "release/tmp"]
coffee:
dev:
files:
"release/js/app.js": ["src/script/*.coffee"]
options:
sourceMap: true
release:
files:
"release/tmp/app.js": ["src/script/*.coffee"]
coffeelint:
app: ['src/script/*.coffee']
copy:
js:
files: [
expand: true
flatten: true
src: ["src/script/**/*.js"]
dest: "release/js/"
]
assets:
files: [
expand: true
flatten: true
src: ["src/assets/**/*"]
dest: "release/assets/"
]
imagemin:
release:
files: [
expand: true
flatten: true
src: ["src/assets/**/*.{png,jpg,gif}"]
dest: "release/assets/"
]
inline:
release:
src: ["release/**/*.html"]
jade:
dev:
files: [
expand: true
cwd: "src"
src: ["**/*.jade", '!**/_*.jade']
dest: "release"
ext: ".html"
]
options:
pretty: true
release:
files: [
expand: true
cwd: "src"
src: ["**/*.jade", '!**/_*.jade']
dest: "release"
ext: ".html"
]
sass:
dev:
files: [
expand: true
cwd: "src/sass"
src: ["**/*.scss"]
dest: "release/css"
ext: ".css"
]
options:
linenos: true
compress: false
includePaths: require('node-bourbon').includePaths
release:
files: [
expand: true
cwd: "src/sass"
src: ["**/*.scss"]
dest: "release/css"
ext: ".css"
]
options:
includePaths: require('node-bourbon').includePaths
uglify:
release:
files: [
expand: true
cwd: "release/tmp"
src: ["**/*.js"]
dest: "release/js"
ext: ".js"
]
watch:
jade:
files: ["src/**/*.jade"]
tasks: ["jade:dev"]
sass:
files: ["src/sass/**/*.scss"]
tasks: ["sass:dev"]
coffee:
files: ["src/script/**/*.coffee"]
tasks: ["newer:coffee:dev"]
js:
files: ["src/script/**/*.js"]
tasks: ["newer:copy:script"]
assets:
files: ["src/assets/**/*"]
tasks: ["newer:copy:assets"]
grunt:
files: ["Gruntfile.coffee", "package.json"]
tasks: ["concurrent:dev"]
options:
spawn: false
livereload: true
# Start server in development mode
grunt.registerTask "default", [
"coffeelint"
"clean"
"concurrent:dev"
"connect:dev"
"watch"
]
# Start server in preview mode
grunt.registerTask "preview", [
"clean:release"
"clean:tmp"
"concurrent:release"
"concurrent:optimize"
"clean:tmp"
"inline:release"
"connect:release"
]
# Build optimized files
grunt.registerTask "build", [
"clean:release"
"clean:tmp"
"concurrent:release"
"concurrent:optimize"
"clean:tmp"
]