-
Notifications
You must be signed in to change notification settings - Fork 16
/
Gruntfile.js
100 lines (95 loc) · 2.68 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
var THEMES = require("./list.json");
var _ = require("lodash");
var pkg = require("./package.json");
module.exports = function (grunt) {
// Load NPM tasks
grunt.loadNpmTasks('grunt-contrib-less');
grunt.loadNpmTasks("grunt-bower-install-simple");
grunt.loadNpmTasks('grunt-gh-pages');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-file-creator');
// Init GRUNT configuraton
grunt.initConfig({
'pkg': pkg,
'bower-install-simple': {
options: {
color: true,
production: false,
directory: "vendors"
}
},
'less': {
development: {
options: {
compress: true,
yuicompress: true,
optimization: 2
},
files: _.chain(THEMES)
.map(function(theme) {
return [
"build/"+theme.id+"/style.css",
theme.id+"/style.less"
];
})
.object()
.value()
}
},
'gh-pages': {
'builds': {
options: {
base: './build',
branch: 'builds'
},
src: "**"
}
},
'copy': {
'themes': {
src: _.chain(THEMES)
.map(function(theme) {
return theme.id+"/**";
})
.concat([
'macros/**',
'!**/*.less',
'list.json'
])
.value(),
dest: 'build/',
},
},
'clean': {
'build': ["./build"]
},
'file-creator': {
'package': {
"build/package.json": function(fs, fd, done) {
fs.writeSync(fd, JSON.stringify({
name: pkg.name,
version: pkg.version,
author: pkg.author,
main: pkg.main
}, null, 4));
done();
}
}
}
});
grunt.registerTask('build', [
'bower-install-simple',
'clean',
'copy:themes',
'file-creator:package',
'less'
]);
grunt.registerTask('publish', [
'build',
'gh-pages'
]);
grunt.registerTask('default', [
'build'
]);
};