-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathGruntFile.js
47 lines (43 loc) · 1.66 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
module.exports = function(grunt) {
var _ = grunt.util._
, pkg = grunt.file.readJSON('package.json')
, srcDir = 'node_modules/'
, tarDir = 'js/'
, manifest = _.keys(pkg.optionalDependencies)
, destinations = _.extend(_.object(manifest, manifest), _.pick({
'ender-js': 'ender',
'response.js': 'response'
}, manifest));
function createFilesMap(suffix) {
return _.inject(destinations, function(memo, base, name) {
memo[tarDir + base + '/' + base + suffix] = [srcDir + name + '/' + base + '.js'];
return memo;
}, {});
}
grunt.initConfig({
pkg: pkg,
concat: {
options: { banner: '' },
build: { files: createFilesMap('.js') }
},
uglify: {
options: { preserveComments: 'some' },
build: { files: createFilesMap('.min.js') }
},
jshint: {
dir: ['*.js'], // current dir
grunt: ['GruntFile.js'],
options: {
ignores: ['**/**/node_modules/', '**/**/vendor/', '**/**.min.js'], // in any dir
expr:true, sub:true, supernew:true, debug:true, node:true,
boss:true, devel:true, evil:true, laxcomma:true, eqnull:true,
undef:true, unused:true, browser:true, jquery:true, maxerr:10
}
}
});
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-uglify');
// 'default' is run by typing 'grunt' on the command line
grunt.registerTask('default', ['jshint:dir', 'concat', 'uglify']);
};