Merge branch 'gh-pages' of git://github.com/thomaspark/bootswatch into gh-pages
[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                         cerulean:{}, amelia: {}
21                 },
22                 clean: {
23                    build: {
24                            src: ['*/build.less', '*/build-responsive.less',
25                                    '!global/build.less', '!global/build-responsive.less']
26                    }
27                 },
28                 concat: {
29                         dist: {
30                                 src: ['global/build.less'],
31                                 dest: ''
32                         }
33                 },
34                 recess: {
35                         dist: {
36                                 options: {
37                                         compile: true
38                                 },
39                                 files: {}
40                         }
41                 },
42                 min: {
43                         build: {
44                                 src: ['<banner:meta.banner>', '<config:concat.build.dest>'],
45                                 dest: '<%= builddir %>/<%= pkg.name %>.min.js'
46                         }
47                 }
48         });
49
50         grunt.registerMultiTask('build', 'build a theme', function() {
51                 var theme = this.target;
52                 grunt.log.writeln('building theme ' + this.target);
53
54                 var concatDest = theme + '/build.less';
55
56                 var recessDest = theme + '/' + theme + '.css';
57                 var recessSrc = [ theme + '/' + 'build.less' ];
58
59                 grunt.config('concat.dist.dest', concatDest);
60                 var files = {}; files[recessDest] = recessSrc;
61                 grunt.config('recess.dist.files', files);
62
63                 grunt.task.run(['concat', 'recess:dist', 'clean:build']);
64         });
65 };