-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathGruntfile.js
205 lines (189 loc) · 6.65 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
195
196
197
198
199
200
201
202
203
204
205
'use strict';
module.exports = function(grunt) {
require('load-grunt-tasks')(grunt);
require('time-grunt')(grunt);
var config = grunt.file.readYAML('./_config.yml');
// Configurable paths
var paths = {
tmp: '.tmp',
assets: './src/generated',
downloads: './src/downloads',
dist: './cbp'
};
grunt.initConfig({
// Project settings
paths: paths,
config: config,
// Watches files for changes and runs tasks based on the changed files
watch: {
js: {
files: ['src/front/scripts/{,*/}*.js'],
tasks: ['jshint', 'concat:mainjs']
},
},
// Clean out gen'd folders
clean: {
dist: {
files: [{
dot: true,
src: [
'<%= paths.dist %>', '<%= paths.assets %>']
}]
}
},
// Lint JS
jshint: {
options: {
jshintrc: '.jshintrc',
reporter: require('jshint-stylish')
},
all: [
'Gruntfile.js',
'src/front/scripts/*.js'
]
},
// SASS -> CSS
sass: {
options: {
loadPath: ['node_modules'],
style: 'expanded',
},
dist: {
files: [{
expand: true,
cwd: 'src/front/styles',
src: ['main.scss'],
dest: '<%= paths.assets %>/styles',
ext: '.css'
}]
}
},
// Add vendor prefixed styles to CSS
autoprefixer: {
options: {
browsers: ['> 4%', 'last 4 versions']
},
dist: {
files: [{
expand: true,
cwd: '<%= paths.assets %>/styles/',
src: '{,*/}*.css',
dest: '<%= paths.assets %>/styles/'
}, {
expand: true,
cwd: '<%= paths.downloads %>/css/',
src: 'src/cbpstrap.min.css',
dest: '<%= paths.downloads %>/css/'
}]
}
},
// Bundle JS/CSS files
concat: {
// misc vendor
vendorjs: {
src: [
'node_modules/jquery/dist/jquery.js',
'node_modules/cbp-theme/dist/cbp-theme-inputmask.umd.js',
'src/front/vendor/jquery-ui-1.11.1.custom/jquery-ui.js',
'node_modules/lodash/lodash.min.js',
'node_modules/jquery-ui/ui/minified/core.min.js',
'node_modules/jquery-ui/ui/minified/datepicker.min.js',
'node_modules/jquery-ui/ui/minified/progressbar.min.js',
'node_modules/hopscotch/dist/js/hopscotch.min.js',
'node_modules/cbp-theme/dist/cbp-theme.browser.bundle.umd.js'
],
dest: '<%= paths.assets %>/scripts/vendor.js'
},
// main js
mainjs: {
src: [
'src/front/scripts/index.js'
],
dest: '<%= paths.assets %>/scripts/main.js'
},
// vendor css
vendorcss: {
src: [
'src/front/vendor/jquery-ui-1.11.1.custom/jquery-ui.structure.css',
'node_modules/font-awesome/css/font-awesome.css',
'node_modules/hopscotch/dist/css/hopscotch.css',
'node_modules/cbp-theme/dist/cbp-theme.css'
],
dest: '<%= paths.assets %>/styles/vendor.css'
},
},
// Copies remaining files to places other tasks can use
copy: {
dist: {
files: [{ // htmlshiv to assets for < IE9
dot: true,
expand: true,
cwd: 'src/front/vendor/html5shiv/',
src: ['html5shiv.min.js'],
dest: '<%= paths.assets %>/vendor/html5shiv/'
}, { // favicon sprite to assets folder
dot: true,
expand: true,
cwd: 'src/front/',
src: 'favicon.ico',
dest: '<%= paths.assets %>/'
},
{
dot: true,
expand: true,
cwd: './src/front/images',
src: '{,*/}*.{gif,jpeg,jpg,png,svg}',
dest: '<%= paths.assets %>/images'
}, {
dot: true,
expand: true,
cwd: './node_modules/cbp-theme/dist',
src: '*.css',
dest: '<%= paths.assets %>/vendor/cbp-theme/styles'
}, {
dot: true,
expand: true,
cwd: './node_modules/cbp-theme/dist',
src: '*.js*',
dest: '<%= paths.assets %>/vendor/cbp-theme/js'
}, {
dot: true,
expand: true,
cwd: './node_modules/nouislider/distribute/',
src: '*',
dest: '<%= paths.assets %>/vendor/nouislider/'
}, {
dot: true,
expand: true,
cwd: './node_modules/font-awesome/fonts',
src: '{,*/}*.{otf,eot,svg,ttf,woff,woff2}',
dest: '<%= paths.assets %>/styles/font-awesome/fonts' // for local development!
}, {
dot: true,
expand: true,
cwd: './node_modules/roboto-fontface/fonts/roboto',
src: '{,*/}*.{woff,woff2}',
dest: '<%= paths.assets %>/styles/roboto-fontface/fonts/roboto' // for local development!
}, {
dot: true,
expand: true,
cwd: './node_modules/hopscotch/dist/img',
src: '{,*/}*.{gif,jpeg,jpg,png}',
dest: '<%= paths.assets %>/img'
}
]
}
}
});
grunt.registerTask('build', [
'clean:dist',
'jshint',
'sass',
'concat',
'autoprefixer',
'copy:dist'
]);
grunt.registerTask('default', [
'build'
]);
};