1 module.exports = function (grunt) {
2 grunt.loadNpmTasks('grunt-recess');
3 grunt.loadNpmTasks('grunt-contrib-concat');
4 grunt.loadNpmTasks('grunt-contrib-clean');
6 // Project configuration.
8 pkg: grunt.file.readJSON('package.json'),
12 ' * <%= pkg.description %>\n' +
13 ' * @version v<%= pkg.version %> - ' +
14 '<%= grunt.template.today("yyyy-mm-dd") %>\n' +
15 ' * @link <%= pkg.homepage %>\n' +
16 ' * @license <%= pkg.license %>' + ' */'
19 amelia: {}, cerulean:{}, cosmo:{}, cyborg:{}, journal:{}, readable:{},
20 shamrock:{}, simplex:{}, slate:{}, spacelab:{}, spruce:{}, superhero:{},
25 src: ['*/build.less', '*/build-responsive.less',
26 '!global/build.less', '!global/build-responsive.less']
46 grunt.registerTask('none', function() {});
48 grunt.registerTask('build', 'build a regular theme', function(theme, compress) {
49 var compress = compress == undefined ? true : compress;
57 concatSrc = 'global/build.less';
58 concatDest = theme + '/build.less';
59 recessDest = '<%=builddir%>/' + theme + '/bootstrap.css';
60 recessSrc = [ theme + '/' + 'build.less' ];
62 dist = {src: concatSrc, dest: concatDest};
63 grunt.config('concat.dist', dist);
64 files = {}; files[recessDest] = recessSrc;
65 grunt.config('recess.dist.files', files);
66 grunt.config('recess.dist.options.compress', false);
68 grunt.task.run(['concat', 'recess:dist', 'clean:build',
69 compress ? 'compress:'+recessDest+':'+'<%=builddir%>/' + theme + '/bootstrap.min.css':'none']);
72 grunt.registerTask('build-responsive', 'build a responsive theme', function(theme, compress) {
73 var compress = compress == undefined ? true : compress;
82 concatSrc = 'global/build-responsive.less';
83 concatDest = theme + '/build-responsive.less';
84 recessDest = '<%=builddir%>/' + theme + '/bootstrap-responsive.css';
85 recessSrc = [ theme + '/' + 'build-responsive.less' ];
87 dist = {src: concatSrc, dest: concatDest};
88 grunt.config('concat.dist', dist);
89 files = {}; files[recessDest] = recessSrc;
90 grunt.config('recess.dist.files', files);
91 grunt.config('recess.dist.options.compress', false);
93 grunt.task.run(['concat', 'recess:dist', 'clean:build',
94 compress ? 'compress:'+recessDest+':'+'<%=builddir%>/' + theme + '/bootstrap-responsive.min.css':'none']);
97 grunt.registerTask('compress', 'compress a generic css', function(fileSrc, fileDst) {
98 var files = {}; files[fileDst] = fileSrc;
99 grunt.log.writeln('compressing file ' + fileSrc);
101 grunt.config('recess.dist.files', files);
102 grunt.config('recess.dist.options.compress', true);
103 grunt.task.run(['recess:dist']);
106 grunt.registerMultiTask('swatch', 'build a theme, both not responsive and responsive', function() {
108 grunt.task.run('build:'+t, 'build-responsive:'+t);