-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.js
94 lines (87 loc) · 2.29 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
module.exports = function(grunt) {
require('load-grunt-tasks')(grunt);
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-webpack');
grunt.initConfig({
project: {
dev: 'src',
dist: 'dist',
},
clean: ['dist'],
sass: {
options: {
sourceMap: true
},
dist: {
files: {
"dist/css/app.dark.css": "src/sass/app.dark.scss",
"dist/css/app.light.css": "src/sass/app.light.scss",
"dist/css/app.office.css": "src/sass/app.office.scss",
}
}
},
less: {
dev: {
files: [{
expand: true,
cwd: 'src/less',
src: ['*'],
dest: 'dist/css/',
rename: function(dest, src) {
var filename = `${dest}${src.replace("less", "css")}`;
console.log(`created ${filename}`);
return filename;
},
}],
options: {
compress: true,
}
},
},
webpack: {
options: {
// stats: !process.env.NODE_ENV || process.env.NODE_ENV === 'development'
stats: {
colors: true,
modules: true,
reasons: false
},
progress: true,
},
prod: require('./build/webpack.prod'),
dev: Object.assign({ watch: true }, require('./build/webpack.dev'))
},
watch: {
styles: {
files: [
'<%= project.dev %>/sass/**/*.scss',
'<%= project.dev %>/less/**/*.less'
],
tasks: ['less:dev', 'sass'],
options: {
livereload: 35728
}
},
scripts: {
files: ['Gruntfile.js',
'<%= project.dev %>/**/*.js',
'<%= project.dev %>/**/*.ts',
'<%= project.dev %>/**/*.html',
'<%= project.dev %>/**/*.json',
'<%= project.dev %>/**/*.svg',
'<%= project.dev %>/img/**',
],
tasks: ['webpack:dev'], // !important
options: {
livereload: 35729
}
},
}
});
grunt.registerTask('default', [
'clean',
'less:dev',
'sass',
'webpack:prod',
]);
};