-
Notifications
You must be signed in to change notification settings - Fork 1
/
Gruntfile.js
49 lines (38 loc) · 1.2 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
module.exports = function( grunt ) {
// Project Configuration
grunt.initConfig( {
pkg : grunt.file.readJSON( 'package.json' ),
srcFiles : 'js/src/*.js',
buildFile : 'js/build/<%= pkg.name %>-<%= pkg.version %>.min.js',
uglify : {
options : {
banner : '/**\n' +
' * <%= pkg.name %> - v<%= pkg.version %> - build <%= grunt.template.today("yyyy-mm-dd HH:mm:ss") %>\n' +
' * Copyright (c) 2014-2015 Selcher;\n' +
' * Distributed under the terms of the MIT license.\n' +
' */\n'
},
build : {
src : '<%= srcFiles %>',
dest : '<%= buildFile %>'
}
},
watch : {
files: [ '<%= srcFiles %>', 'Gruntfile.js' ],
tasks: [ 'uglify' ]
}
} );
// Load the plugins
// uglify -> minify
// watch -> watch file changes
grunt.loadNpmTasks( 'grunt-contrib-uglify' );
grunt.loadNpmTasks( 'grunt-contrib-jshint' );
grunt.loadNpmTasks( 'grunt-contrib-watch' );
// Defalt task : just minify code
grunt.registerTask( 'default', [ 'uglify' ] );
// Development : watch for file changes and run:
// 1. jasmine for code testing
grunt.registerTask( 'dev', [ 'watch' ] );
// Production : check code and then minify
grunt.registerTask( 'prod', [ 'uglify' ] );
};