-
Notifications
You must be signed in to change notification settings - Fork 2
/
Gruntfile.js
57 lines (54 loc) · 1.7 KB
/
Gruntfile.js
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
module.exports = function(grunt) {
grunt.initConfig({
bwr: grunt.file.readJSON('bower.json'),
pkg: grunt.file.readJSON('package.json'),
uglify: {
options: {
// the banner is inserted at the top of the output
banner: '/*! <%= pkg.name %> version <%= pkg.version %> <%= grunt.template.today("dd-mm-yyyy") %> */\n'
},
my_target: {
files: {
'white-space.min.js': ['white-space.js'],
'white-space-fast.min.js': ['white-space-fast.js']
}
}
},
compress: {
main: {
options: {
mode: 'gzip',
pretty: true
},
expand: true,
src: ['*.min.js']
}
}
});
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-compress');
/* check if we remembered to sync versions in bower.json and package.json,
* the version from package.json is written in the banner */
grunt.registerTask('version', 'Test bower.json and package.json versions', function version() {
grunt.log.write('Checking if versions are in sync...');
grunt.config.requires('bwr.version');
grunt.config.requires('pkg.version');
if( grunt.config.data.bwr.version === grunt.config.data.pkg.version ) {
grunt.log.ok();
return true;
} else {
grunt.log.writeln("");
grunt.log.error(
'bower.json version '
+ grunt.config.data.bwr.version
+ ' is not in sync with package.json version '
+ grunt.config.data.pkg.version
+ '.'
);
return false;
}
});
// Register building task
grunt.registerTask('default', ['uglify', 'compress']); // for convenience
grunt.registerTask('build', ['uglify', 'compress']);
}