-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathGruntfile.coffee
167 lines (148 loc) · 4.5 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
module.exports = (grunt) ->
# Handlebars gets loaded via the grunt contrib. This might break, but it works for now.
hbs =
'dist/js/handlebars.js': 'node_modules/grunt-contrib-handlebars/node_modules/handlebars/dist/handlebars.js'
imageTypes = [
'*.jpg'
'*.jpeg'
'*.gif'
'*.png'
]
grunt.initConfig
pkg: grunt.file.readJSON 'package.json'
coffee:
compile:
options:
bare: true
expand: true
cwd: 'src/'
src: ['**/*.coffee']
dest: 'dist/js/'
ext: '.js'
handlebars:
compile:
options:
namespace: 'sm.tmpl'
node: true
simple: true
min: true
root: 'sm'
expand: true
cwd: 'src/views'
src: ['**/*.html']
dest: 'dist/js'
ext: '.tmpl.js'
sass:
# Compile bootstrap and responsive first as they need not be watched.
init:
options:
style: 'expanded'
files: [
'dist/styles/bootstrap.css': 'src/sass/bootstrap/bootstrap.scss'
'dist/styles/responsive.css': 'src/sass/bootstrap/responsive.scss'
]
# This will be used when watch triggers a re-compile of sass files
main:
options:
style: 'expanded'
files: [
'dist/styles/core.css': 'src/sass/core.sass'
]
dist:
options:
style: 'compressed'
trace: true
files: [
'dist/styles/core.css': 'src/sass/core.sass'
'dist/styles/bootstrap.css': 'src/sass/bootstrap/bootstrap.scss'
'dist/styles/responsive.css': 'src/sass/bootstrap/responsive.scss'
]
copy:
main:
files: [
expand: true
cwd: 'lib/dev'
src: ['*.js']
dest: 'dist/js'
filter: 'isFile'
,
expand:true
cwd: 'img'
src: imageTypes
dest: 'dist/img'
filter: 'isFile'
,
expand: true
src: ['*.html']
dest: 'dist'
filter: 'isFile'
,
hbs
]
dist:
files: [
expand: true
cwd: 'lib'
src: ['*.js']
dest: 'dist/js'
filter: 'isFile'
,
expand:true
cwd: 'img'
src: imageTypes
dest: 'dist/img'
filter: 'isFile'
,
expand: true
src: ['*.html']
dest: 'dist'
filter: 'isFile'
,
hbs
]
watch:
js:
files: ['src/**/*.coffee']
tasks: ['coffee']
tmpl:
files: ['src/**/*.html']
tasks: ['handlebars']
style:
files: [
'**/*.sass'
'**/*.scss'
]
tasks: ['sass:main']
clean:
bkup:
src: ['**/*~']
filter: 'isFile'
js:
cwd: 'src'
src: ['**/*.js']
filter: 'isFile'
dist: 'dist'
grunt.loadNpmTasks 'grunt-contrib-copy'
grunt.loadNpmTasks 'grunt-contrib-coffee'
grunt.loadNpmTasks 'grunt-contrib-handlebars'
grunt.loadNpmTasks 'grunt-contrib-sass'
grunt.loadNpmTasks 'grunt-contrib-watch'
grunt.loadNpmTasks 'grunt-contrib-clean'
grunt.registerTask 'default', [
'copy:main'
'coffee'
'handlebars'
'sass:init'
'sass:main'
]
grunt.registerTask 'dist', [
'clean'
'copy:dist'
'coffee'
'handlebars'
'sass:dist'
]
# grunt.registerTask 'lint', [
#
# ]
return