-
Notifications
You must be signed in to change notification settings - Fork 8
/
Gruntfile.js
194 lines (187 loc) · 5.52 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
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
'use strict';
// # Globbing
// for performance reasons we're only matching one level down:
// 'test/spec/{,*/}*.js'
// use this if you want to match all subfolders:
// 'test/spec/**/*.js'
// templateFramework: 'lodash'
module.exports = function (grunt) {
// show elapsed time at the end
require('time-grunt')(grunt);
// load all grunt tasks
require('load-grunt-tasks')(grunt);
// configurable paths
var theme = grunt.option('theme') || 'base';
var osciConfig = {
app: 'app/oscitk/themes/' + theme,
dist: 'dist/themes/' + theme
};
grunt.initConfig({
osci: osciConfig,
watch: {
options: {
nospawn: true,
livereload: true
},
compass: {
files: ['<%= osci.app %>/styles/{,*/}*.{scss,sass}'],
tasks: ['compass']
},
livereload: {
files: [
'<%= osci.app %>/*.html',
'{.tmp,<%= osci.app %>}/styles/{,*/}*.css',
'{.tmp,<%= osci.app %>}/views/{,*/}*.js',
'<%= osci.app %>/images/{,*/}*.{png,jpg,jpeg,gif,webp}',
'<%= osci.app %>/templates/*.tpl.html',
'test/spec/**/*.js'
]
},
jst: {
files: [
'<%= osci.app %>/templates/*.html'
],
tasks: ['jst']
}
},
clean: {
dist: ['.tmp', '<%= osci.dist %>/*']
},
compass: {
options: {
sassDir: '<%= osci.app %>/styles',
cssDir: '<%= osci.app %>/styles/css',
imagesDir: '<%= osci.app %>/images',
javascriptsDir: '<%= osci.app %>/views',
fontsDir: '<%= osci.app %>/styles/fonts',
relativeAssets: true
},
dist: {}
},
// not enabled since usemin task does concat and uglify
// check index.html to edit your build targets
// enable this task if you prefer defining your build targets here
/*uglify: {
dist: {}
},*/
useminPrepare: {
html: '<%= osci.app %>/index.html',
options: {
dest: '<%= osci.dist %>'
}
},
usemin: {
html: ['<%= osci.dist %>/{,*/}*.html'],
css: ['<%= osci.dist %>/styles/css/{,*/}*.css'],
options: {
dirs: ['<%= osci.dist %>']
}
},
imagemin: {
dist: {
files: [{
expand: true,
cwd: '<%= osci.app %>/images',
src: '{,*/}*.{png,jpg,jpeg}',
dest: '<%= osci.dist %>/images'
}]
}
},
cssmin: {
dist: {
files: {
'<%= osci.dist %>/styles/css/main.css': [
'<%= osci.app %>/styles/{,*/}*.css'
]
}
}
},
htmlmin: {
dist: {
options: {
/*removeCommentsFromCDATA: true,
// https://github.com/osci/grunt-usemin/issues/44
//collapseWhitespace: true,
collapseBooleanAttributes: true,
removeAttributeQuotes: true,
removeRedundantAttributes: true,
useShortDoctype: true,
removeEmptyAttributes: true,
removeOptionalTags: true*/
},
files: [{
expand: true,
cwd: '<%= osci.app %>',
src: '*.html',
dest: '<%= osci.dist %>'
}]
}
},
copy: {
dist: {
files: [{
expand: true,
dot: true,
cwd: '<%= osci.app %>',
dest: '<%= osci.dist %>',
src: [
'*.{ico,txt}',
'images/{,*/}*.{webp,gif}',
'styles/fonts/{,*/}*.*',
'oscitk.json',
'templates/{,*/}*.*',
]
}]
}
},
jst: {
compile: {
files: {
'<%= osci.dist %>/scripts/templates.js': ['<%= osci.app %>/templates/*.html']
}
}
}//,
// rev: {
// dist: {
// files: {
// src: [
// '<%= osci.dist %>/scripts/{,*/}*.js',
// '<%= osci.dist %>/styles/css/{,*/}*.css',
// '/styles/fonts/{,*/}*.*'
// ]
// }
// }
// }
});
grunt.registerTask('build', [
'clean:dist',
'jst',
'compass:dist',
'useminPrepare',
'imagemin',
'htmlmin',
'concat',
'cssmin',
'uglify',
'copy',
'usemin'
]);
grunt.registerTask('final', [
'clean:dist',
'jst',
'compass:dist',
'useminPrepare',
'imagemin',
'htmlmin',
'concat',
'cssmin',
'uglify',
'copy',
//'rev',
'usemin'
]);
grunt.registerTask('default', [
'build',
'watch'
]);
};