This repository has been archived by the owner on Jul 12, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Gruntfile.js
61 lines (60 loc) · 2.22 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
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
requirejs: {
options: {
banner: '/*! <%= pkg.name %>-<%= pkg.version %>.js create by <%= pkg.author %> <%= grunt.template.today("yyyy-mm-dd") %> */',
mainConfigFile: 'src/config/config.js',
baseUrl: 'src',
findNestedDependencies: true,
optimize: 'none',
onModuleBundleComplete: function(data) {
var fs = require('fs'),
amdclean = require('amdclean'),
outputFile = data.path;
fs.writeFileSync(outputFile, amdclean.clean({
filePath: outputFile,
wrap: {
start: this.banner + '\n(function(win, doc, undefined) {\n',
end: '\nwin.epg = epg;\n})(window, document);'
}
}));
},
include: ['<%= pkg.name %>'],
out: 'build/epg.js'
},
build: {}
},
jshint: {
options: {
jshintrc: '.jshintrc'
},
build: ['Gruntfile.js', 'build/<%= pkg.name %>.js']
},
uglify: {
options: {
banner: '/*! <%= pkg.name %>-<%= pkg.version %>.js create by <%= pkg.author %> <%= grunt.template.today("yyyy-mm-dd") %> */',
compress: false,
mangle: true
},
build: {
src: 'build/epg.js',
dest: 'build/<%= pkg.name %>.min.js'
}
},
watch: {
options: {
spawn: false
},
build: {
files: ['src/modules/**.js', 'src/**.js'],
tasks: ['jshint', 'requirejs', 'uglify']
}
}
});
grunt.loadNpmTasks('grunt-contrib-requirejs');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.registerTask('default', ['requirejs', 'jshint', 'uglify', 'watch']);
};