-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGruntfile.js
133 lines (121 loc) · 3.55 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
module.exports = function (grunt) {
require('load-grunt-tasks')(grunt);
grunt.initConfig({
less: {
development: {
options: {
//paths: ["css"]
// sourceMap: false,
// sourceMapFilename: "compiled/css/style-map.css",
// sourceMapURL: "style-map.css",
//modifyVars: {
// 'brand-primary': 'red'
//}
},
files: {
"compiled/css/style.css": "src/css/style.less",
"compiled/css/match-comments-iframe.css": "src/css/match-comments-iframe.less"
}
},
production: {
options: {
//paths: ["css"],
cleancss: true
//modifyVars: {
// imgPath: '"http://mycdn.com/path/to/images"',
// bgColor: 'red'
//}
},
files: {
"compiled/css/style.css": "src/css/style.less"
}
}
},
cssmin: {
combine: {
files: {
'compiled/css/style.min.css': ['compiled/css/style.css'],
'compiled/css/match-comments-iframe.min.css': ['compiled/css/match-comments-iframe.css']
}
}
},
csssplit: {
split: {
src: ['compiled/css/style.css'],
dest: 'compiled/css/style.css',
options: {
maxSelectors: 4095,
maxPages: 2,
suffix: '_split_'
}
},
},
csscss: {
dist: {
options: {
outputJson: true
},
files: {
'output.json': ['compiled/css/style.css']
}
}
},
postcss: {
options: {
// map: true,
processors: [
require('autoprefixer-core')({browsers: ['last 1 version']})
]
},
dist: {
src: ['compiled/css/style.css']
}
},
compress: {
main: {
options: {
mode: 'gzip'
},
expand: true,
src: ['compiled/css/style.css'],
dest: 'compiled/css/style.css.gzip',
}
},
autoprefixer: {
options: {
browsers: [
"Android >= 4",
"Chrome >= 20",
"Firefox >= 24",
"Explorer >= 8",
"iOS >= 6",
"Opera >= 12",
"Safari >= 6"
]
},
dev: {
options: {
// map: true
},
src: [
"compiled/css/style.css",
"compiled/css/match-comments-iframe.css"
]
}
},
watch: {
files: "**/*.less",
tasks: ["less:development", "autoprefixer", "csssplit:split", "cssmin"]
}
});
grunt.loadNpmTasks('grunt-contrib-less');
grunt.loadNpmTasks('grunt-contrib-cssmin');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-csssplit');
grunt.loadNpmTasks('grunt-csscss');
grunt.loadNpmTasks('grunt-postcss');
grunt.loadNpmTasks('grunt-contrib-compress');
//grunt.loadNpmTasks('grunt-uncss');
grunt.registerTask('default', ["less:development", "autoprefixer", "csssplit:split", "cssmin"]);
grunt.registerTask('build', ['less:production', 'cssmin']);
};