summaryrefslogtreecommitdiff
path: root/Gruntfile.js
blob: 4d8fcf7bef63a8408c459ff6839708f804513285 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
module.exports = function (grunt) {
	grunt.loadNpmTasks('grunt-recess');
	grunt.loadNpmTasks('grunt-contrib-concat');
	grunt.loadNpmTasks('grunt-contrib-clean');
	// grunt.loadNpmTasks('grunt-contrib-uglify');

	// Project configuration.
	grunt.initConfig({
		builddir: 'build',
		pkg: grunt.file.readJSON('package.json'),
		meta: {
			banner: '/**\n' +
						' * <%= pkg.description %>\n' +
						' * @version v<%= pkg.version %> - ' +
						'<%= grunt.template.today("yyyy-mm-dd") %>\n' +
						' * @link <%= pkg.homepage %>\n' +
						' * @license <%= pkg.license %>' + ' */'
		},
		build: {
			amelia: {}, cerulean:{}, cosmo:{}, cyborg:{}, journal:{}, readable:{},
			shamrock:{}, simplex:{}, slate:{}, spacelab:{}, spruce:{}, superhero:{},
			united:{}
		},
		clean: {
		   build: {
			   src: ['*/build.less', '*/build-responsive.less',
				   '!global/build.less', '!global/build-responsive.less']
		   }
		},
		concat: {
			dist: {
				src: ['global/build.less'],
				dest: ''
			}
		},
		recess: {
			dist: {
				options: {
					compile: true
				},
				files: {}
			}
		},
		min: {
			build: {
				src: ['<banner:meta.banner>', '<config:concat.build.dest>'],
				dest: '<%= builddir %>/<%= pkg.name %>.min.js'
			}
		}
	});

	grunt.registerMultiTask('build', 'build a theme', function() {
		var theme = this.target;
		grunt.log.writeln('building theme ' + this.target);

		var concatDest = theme + '/build.less';

		var recessDest = theme + '/' + theme + '.css';
		var recessSrc = [ theme + '/' + 'build.less' ];

		grunt.config('concat.dist.dest', concatDest);
		var files = {}; files[recessDest] = recessSrc;
		grunt.config('recess.dist.files', files);

		grunt.task.run(['concat', 'recess:dist', 'clean:build']);
	});
};