-
Notifications
You must be signed in to change notification settings - Fork 125
/
Gruntfile.js
81 lines (65 loc) · 1.88 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
module.exports = function(grunt) {
var config = {};
//src ===============================
var src;
config.src = src = {
sassMain: 'scss/main.scss',
distFolder: 'examples/css/app.dist.css',
devFolder: 'examples/css/app.dev.css',
sassFolder: 'scss/**/*.scss',
serverPort: 8000
};
//Watch ===============================
config.watch = {
scripts: {
files: ["<%= src.sassFolder %>"],
tasks: ["dev", "sass:dist"]
//,tasks: ["dev",'sass:dist']
}
}
//Sass ===============================
var sass;
config.sass = sass = {};
//distribution
sass.dist = {
options: {
style: "compressed",
noCache: true,
sourcemap: 'none',
update: true
},
files: {
"<%= src.distFolder %>": "<%= src.sassMain %>"
}
};
//development env.
sass.dev = {
options: {
style: "expanded",
lineNumber: true,
},
files: {
"<%= src.devFolder %>": "<%= src.sassMain %>"
}
};
//grunt serve ===============================
config.connect = {
server: {
options: {
livereload: true,
port: "<%= src.serverPort %>"
}
}
};
//Register custom tasks ===============================
grunt.registerTask('default', ['dev']);
grunt.registerTask('dev', ['sass:dev']);
grunt.registerTask('dist', ['sass:dist']);
grunt.registerTask('serve', ['connect:server', 'watch']);
require('time-grunt')(grunt);
require('load-grunt-tasks')(grunt, {
scope: 'devDependencies'
});
//General setup ===============================
grunt.initConfig(config);
};