forked from jquery-archive/css-chassis
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGruntfile.js
More file actions
199 lines (185 loc) · 3.84 KB
/
Gruntfile.js
File metadata and controls
199 lines (185 loc) · 3.84 KB
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
module.exports = function( grunt ) {
require( "load-grunt-tasks" )( grunt );
var config = {
htmllint: {
dist: {
options: {},
src: [ "demos/*.html" ]
}
},
autoprefixer: {
dist: {
options: {
map: true,
browsers: [
"> 1%",
"last 2 versions",
"safari >= 5.1",
"ios >= 6.1",
"android 2.3",
"android >= 4",
"ie >= 8"
]
},
src: "dist/css/*.css"
}
},
csscomb: {
dist: {
files: {
"dist/css/chassis.css": "dist/css/chassis.css"
}
},
scss: {
files: [ {
expand: true,
src: [ "scss/**/*.scss" ]
} ]
}
},
cssmin: {
options: {
report: "gzip",
sourceMap: true
},
target: {
files: {
"dist/css/chassis.min.css": "dist/css/chassis.css"
}
}
},
csslint: {
src: [ "dist/css/chassis.lint.css", "dist/css/chassis.lint.css", "demos/demos.css" ]
},
jscs: {
all: [ "*.js", "performance/**/*.js" ]
},
jshint: {
files: [ "*.js", "performance/**/*.js" ],
options: {
jshintrc: ".jshintrc"
}
},
npmcopy: {
options: {
destPrefix: "external"
},
normalize: {
files: {
"normalize.css/LICENSE.md": "normalize.css/LICENSE.md",
"normalize.css/normalize.scss": "normalize.css/normalize.css"
}
}
},
sass: {
// This is the same as lint below except including normalize.css
dist: {
options: {
sourceMap: true,
// This actually does nested until libsass updates to support expanded
outputStyle: "expanded"
},
files: {
"dist/css/chassis.css": "scss/style.scss"
}
},
// This is everything except normalize.css which won't pass our lint settings
lint: {
options: {
sourceMap: true,
// This actually does nested until libsass updates to support expanded
outputStyle: "expanded"
},
files: {
"dist/css/chassis.lint.css": "scss/lint.scss"
}
}
},
// Minifies SVGs
svgmin: {
options: {
plugins: [
{
removeViewBox: false
},
{
removeUselessStrokeAndFill: false
}
]
},
dist: {
files: [ {
expand: true,
cwd: "icons/svg-source",
src: [ "*.svg" ],
dest: "icons/svg-min/",
ext: ".svg"
} ]
}
},
// Combines SVGs into single file
svgstore: {
defaults: {
options: {
// This will prefix each ID
prefix: "icon-",
// Adds attributes to the resulting SVG
svg: {
viewBox: "0 0 24 24",
xmlns: "http://www.w3.org/2000/svg"
},
cleanup: [ "style", "fill", "id" ]
},
files: {
"icons/icons.svg": [ "icons/svg-min/*.svg" ]
}
}
},
watch: {
sass: {
files: [ "scss/**/*.scss" ],
tasks: [ "build" ],
options: {
spawn: false
}
},
svg: {
files: [ "svg-source/**/*.svg" ],
tasks: [ "svg" ],
options: {
spawn: false
}
}
},
"stop-selenium-server": {
dev: {}
}
};
// This loads files in the options folder as task options
// and builds an object based on their file names
function loadConfig(path) {
var glob = require( "glob" ),
object = {},
key;
glob.sync( "*", { cwd: path } ).forEach( function( option ) {
key = option.replace( /\.js$/, "" );
object[ key ] = require( path + option );
});
return object;
}
// We no combine the loaded task options with the ones defined in config above
grunt.util._.extend( config, loadConfig( "./tasks/options/" ) );
grunt.initConfig( config );
grunt.loadTasks( "tasks" );
grunt.loadNpmTasks( "perfjankie" );
grunt.registerTask( "default", [ "test" ] );
grunt.registerTask( "test", [ "build", "jshint", "jscs", "csslint", "htmllint" ] );
grunt.registerTask( "build", [ "svg", "sass", "csscomb", "cssmin" ] );
grunt.registerTask( "perf", [
"start-selenium-server",
"connect:perf",
"perfjankie",
"stop-selenium-server"
]);
grunt.registerTask( "svg", [ "svgmin", "svgstore" ] );
};