-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGruntfile.js
More file actions
49 lines (42 loc) · 1.31 KB
/
Gruntfile.js
File metadata and controls
49 lines (42 loc) · 1.31 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
module.exports = function(grunt) {
function recruseImports (filename) {
var str = grunt.file.read(filename),
filecontents = '',
imports = /@import\W+?[\"\'](.*?)[\"\']\;/ig,
matches = str.match(imports);
if(matches !== null && matches.length > 0) {
for (var i = 0; i < matches.length; i++) {
swapOutString = matches[i];
filecontents = recruseImports(swapOutString.replace(imports, "$1"));
str = str.replace(matches[i], filecontents);
filecontents = '';
}
}
return str;
}
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
lesslint:{
src: ['bkb-dev.less']
},
csslint: {
options:{
csslintrc: 'config/.csslintrc'
}
}
});
grunt.loadNpmTasks('grunt-lesslint')
// Default task(s).
grunt.registerTask('build', function () {
var buildStr = recruseImports('basekit-bootstrap-precompiled.less'),
vars = grunt.file.read('vars.less');
// This is the version that gets linted; includes
// all the vars so linting doesn't fall over
grunt.file.write('basekit-bootstrap-dev.less', vars+buildStr);
// This is the production version of bkb. The
// one that will get released with BaseKit
grunt.file.write('basekit-bootstrap.less', buildStr);
grunt.task.run('lesslint');
});
};