material-kit/js/bootstrap-datepicker.js
[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-watch');
6
7         // Project configuration.
8         grunt.initConfig({
9                 pkg: grunt.file.readJSON('package.json'),
10                 builddir: '.',
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                 swatch: {
20                         amelia:{}, cerulean:{}, cosmo:{}, cyborg:{}, flatly:{}, journal:{},
21                         readable:{}, simplex:{}, slate:{}, spacelab:{}, united:{}, yeti: {},
22                         custom:{}
23                 },
24                 clean: {
25                         build: {
26                                 src: ['*/build.less', '!global/build.less']
27                         }
28                 },
29                 concat: {
30                         dist: {
31                                 src: [],
32                                 dest: ''
33                         }
34                 },
35                 recess: {
36                         dist: {
37                                 options: {
38                                         compile: true,
39                                         compress: false
40                                 },
41                                 files: {}
42                         }
43                 }
44         });
45
46         grunt.registerTask('none', function() {});
47
48         grunt.registerTask('build', 'build a regular theme', function(theme, compress) {
49                 var compress = compress == undefined ? true : compress;
50
51                 var concatSrc;
52                 var concatDest;
53                 var recessDest;
54                 var recessSrc;
55                 var files = {};
56                 var dist = {};
57                 concatSrc = 'global/build.less';
58                 concatDest = theme + '/build.less';
59                 recessDest = '<%=builddir%>/' + theme + '/bootstrap.css';
60                 recessSrc = [ theme + '/' + 'build.less' ];
61
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);
67
68                 grunt.task.run(['concat', 'recess:dist', 'clean:build',
69                         compress ? 'compress:'+recessDest+':'+'<%=builddir%>/' + theme + '/bootstrap.min.css':'none']);
70         });
71
72         grunt.registerTask('compress', 'compress a generic css', function(fileSrc, fileDst) {
73                 var files = {}; files[fileDst] = fileSrc;
74                 grunt.log.writeln('compressing file ' + fileSrc);
75
76                 grunt.config('recess.dist.files', files);
77                 grunt.config('recess.dist.options.compress', true);
78                 grunt.task.run(['recess:dist']);
79         });
80
81         grunt.registerMultiTask('swatch', 'build a theme', function() {
82                 var t = this.target;
83                 grunt.task.run('build:'+t);
84         });
85         
86         grunt.registerTask('default', 'build a theme', function() {
87                 grunt.task.run('swatch');
88         });
89 };