forked from dcarrith/jquery.mobile.lazyloader
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGruntfile.js
81 lines (76 loc) · 1.97 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
"use strict";
/* global module, require */
module.exports = function( grunt ) {
require( "load-grunt-tasks" )( grunt );
grunt.initConfig( {
pkg: grunt.file.readJSON( "package.json" ),
concat: {
dist: {
src: [ "src/*.js" ],
dest: "dist/<%= pkg.name %>.js",
nonull: true,
options: {
// Replace all 'use strict' statements in the code with a single one at the top
banner: "\"use strict\";\n\n",
process: function( src, filepath ) {
return "// Source: " + filepath + "\n" +
src.replace( /(^|\n)[ \t]*('use strict'|"use strict");?\s*/g, "$1" );
}
}
}
},
wrap: {
dist: {
src: [ "dist/<%= pkg.name %>.js" ],
dest: "dist/<%= pkg.name %>.js",
options: {
wrapper: [ "( function( $, window ) {\n", "\n} )( jQuery, window );\n" ]
}
}
},
eslint: {
options: {
configFile: ".eslintrc"
},
target: [ "src/*", "test/*" ]
},
uglify: {
uglified: {
mangle: {
reserved: [ "jQuery" ]
},
files: {
"dist/<%= pkg.name %>.min.js": [ "dist/<%= pkg.name %>.js" ]
}
}
},
karma: {
unit: {
configFile: "karma.conf.js"
}
},
watcher: {
test: {
files: [ "src/*.js", "test/*.js" ],
tasks: [ "karma" ],
options: {
spawn: true
}
}
},
coveralls: {
options: {
coverageDir: "coverage",
recursive: true
}
}
} );
grunt.loadNpmTasks( "grunt-karma-coveralls" );
grunt.loadNpmTasks( "grunt-wrap" );
grunt.loadNpmTasks( "grunt-karma" );
grunt.loadNpmTasks( "grunt-watcher" );
grunt.loadNpmTasks( "grunt-contrib-uglify-es" );
grunt.loadNpmTasks( "grunt-contrib-concat" );
grunt.registerTask( "dev", [ "eslint", "karma", "coveralls" ] );
grunt.registerTask( "dist", [ "concat:dist", "wrap:dist", "uglify" ] );
};