-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgruntfile.js
executable file
·103 lines (92 loc) · 2.84 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
var grunt = require('grunt');
var BUILD_PATH = 'public_grunt',
SRC_PATH = 'src';
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-sass');
grunt.loadNpmTasks('grunt-contrib-coffee');
grunt.loadNpmTasks('grunt-contrib-jade');
grunt.loadNpmTasks('grunt-contrib-concat');
/**steps:
1 clear bulid path
2 join all scss file --> compile to "main.css" --> copy to bulid path
3 join all coffee file --> compile to "main.js" --> copy to bulid path
4 compile index.jade to index.html --> copy to bulid path
**/
grunt.initConfig({
clean: {
dist: {
src: [BUILD_PATH]
}
},
sass: {
//! NOT support multiple .sass file in directory, have to use @import in css file
//https://github.com/gruntjs/grunt-contrib-sass/issues/55
dist: {
options: {
trace: true
},
files: [{
cwd: SRC_PATH + '/styles',
src: ['**/*.scss'],
dest: '.sass-cache/styles',
expand: true,
ext: '.css'
}]
}
// dist: {
// files: [{
// //'public_grunt/assets/styles/main.css': SRC_PATH + '/styles/*.scss'
// expand: true,
// cwd: SRC_PATH + '/styles',
// src: ['**/*.scss'],
// dest: BUILD_PATH + '/assets/styles',
// ext: '.css'
// }]
// }
// dist: {
// options: {
// expand: true
// },
// src: SRC_PATH + '/styles/*.sass',
// dest: BUILD_PATH + '/assets/styles/main.css'
// }
},
concat: {
sass: {
src: ['.sass-cache/styles/**/*.css'],
dest: BUILD_PATH + '/assets/styles/main.css'
}
},
coffee: {
dist: {
options: {
bare: true
},
files: {
'public_grunt/assets/js/main.js': [SRC_PATH + '/app/*.coffee']
}
}
},
jade: {
dist: {
options: {
pretty: true
},
files: {
'public_grunt/index.html': [SRC_PATH + '/tpls/index.jade'],
}
}
}
});
grunt.registerTask('default', ['clean', 'sass', 'concat', 'coffee', 'jade']);
grunt.registerTask('css', ['clean', 'sass', 'concat']);
//TODO: for concat libs like jquery, angularjs... to one single file
// concat: {
// options: {
// separator: ';',
// },
// dist: {
// src: ['src/intro.js', 'src/project.js', 'src/outro.js'],
// dest: 'dist/built.js',
// },
// },