4d8fcf7bef63a8408c459ff6839708f804513285
[bootswatch] / Gruntfile.js
1 module.exports = function (grunt) {
2         grunt.loadNpmTasks('grunt-recess');
3         grunt.loadNpmTasks('grunt-contrib-concat');
4         grunt.loadNpmTasks('grunt-contrib-clean');
5         // grunt.loadNpmTasks('grunt-contrib-uglify');
6
7         // Project configuration.
8         grunt.initConfig({
9                 builddir: 'build',
10                 pkg: grunt.file.readJSON('package.json'),
11                 meta: {
12                         banner: '/**\n' +
13                                                 ' * <%= pkg.description %>\n' +
14                                                 ' * @version v<%= pkg.version %> - ' +
15                                                 '<%= grunt.template.today("yyyy-mm-dd") %>\n' +
16                                                 ' * @link <%= pkg.homepage %>\n' +
17                                                 ' * @license <%= pkg.license %>' + ' */'
18                 },
19                 build: {
20                         amelia: {}, cerulean:{}, cosmo:{}, cyborg:{}, journal:{}, readable:{},
21                         shamrock:{}, simplex:{}, slate:{}, spacelab:{}, spruce:{}, superhero:{},
22                         united:{}
23                 },
24                 clean: {
25                    build: {
26                            src: ['*/build.less', '*/build-responsive.less',
27                                    '!global/build.less', '!global/build-responsive.less']
28                    }
29                 },
30                 concat: {
31                         dist: {
32                                 src: ['global/build.less'],
33                                 dest: ''
34                         }
35                 },
36                 recess: {
37                         dist: {
38                                 options: {
39                                         compile: true
40                                 },
41                                 files: {}
42                         }
43                 },
44                 min: {
45                         build: {
46                                 src: ['<banner:meta.banner>', '<config:concat.build.dest>'],
47                                 dest: '<%= builddir %>/<%= pkg.name %>.min.js'
48                         }
49                 }
50         });
51
52         grunt.registerMultiTask('build', 'build a theme', function() {
53                 var theme = this.target;
54                 grunt.log.writeln('building theme ' + this.target);
55
56                 var concatDest = theme + '/build.less';
57
58                 var recessDest = theme + '/' + theme + '.css';
59                 var recessSrc = [ theme + '/' + 'build.less' ];
60
61                 grunt.config('concat.dist.dest', concatDest);
62                 var files = {}; files[recessDest] = recessSrc;
63                 grunt.config('recess.dist.files', files);
64
65                 grunt.task.run(['concat', 'recess:dist', 'clean:build']);
66         });
67 };