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 simplex:{}, slate:{}, spacelab:{}, spruce:{}, superhero:{}, united:{}
24 src: ['*/build.less', '*/build-responsive.less',
25 '!global/build.less', '!global/build-responsive.less']
45 grunt.registerTask('none', function() {});
47 grunt.registerTask('build', 'build a regular theme', function(theme, compress) {
48 var compress = compress == undefined ? true : compress;
56 concatSrc = 'global/build.less';
57 concatDest = theme + '/build.less';
58 recessDest = '<%=builddir%>/' + theme + '/bootstrap.css';
59 recessSrc = [ theme + '/' + 'build.less' ];
61 dist = {src: concatSrc, dest: concatDest};
62 grunt.config('concat.dist', dist);
63 files = {}; files[recessDest] = recessSrc;
64 grunt.config('recess.dist.files', files);
65 grunt.config('recess.dist.options.compress', false);
67 grunt.task.run(['concat', 'recess:dist', 'clean:build',
68 compress ? 'compress:'+recessDest+':'+'<%=builddir%>/' + theme + '/bootstrap.min.css':'none']);
71 grunt.registerTask('build-responsive', 'build a responsive theme', function(theme, compress) {
72 var compress = compress == undefined ? true : compress;
81 concatSrc = 'global/build-responsive.less';
82 concatDest = theme + '/build-responsive.less';
83 recessDest = '<%=builddir%>/' + theme + '/bootstrap-responsive.css';
84 recessSrc = [ theme + '/' + 'build-responsive.less' ];
86 dist = {src: concatSrc, dest: concatDest};
87 grunt.config('concat.dist', dist);
88 files = {}; files[recessDest] = recessSrc;
89 grunt.config('recess.dist.files', files);
90 grunt.config('recess.dist.options.compress', false);
92 grunt.task.run(['concat', 'recess:dist', 'clean:build',
93 compress ? 'compress:'+recessDest+':'+'<%=builddir%>/' + theme + '/bootstrap-responsive.min.css':'none']);
96 grunt.registerTask('compress', 'compress a generic css', function(fileSrc, fileDst) {
97 var files = {}; files[fileDst] = fileSrc;
98 grunt.log.writeln('compressing file ' + fileSrc);
100 grunt.config('recess.dist.files', files);
101 grunt.config('recess.dist.options.compress', true);
102 grunt.task.run(['recess:dist']);
105 grunt.registerMultiTask('swatch', 'build a theme, both not responsive and responsive', function() {
107 grunt.task.run('build:'+t, 'build-responsive:'+t);