Repository navigation
Expand file tree
/
Copy pathGruntFile.js
More file actions
executable file
·92 lines (87 loc) · 1.83 KB
/
Copy pathGruntFile.js
File metadata and controls
executable file
·92 lines (87 loc) · 1.83 KB
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
82
83
84
85
86
87
88
89
90
91
92
module.exports = function (grunt) {
'use strict';
grunt.initConfig({
pkg : grunt.file.readJSON('package.json'),
uglify:{
options: {
banner: '// <%= pkg.name %>\n' +
'// version: <%= pkg.version %>\n' +
'// update: <%= grunt.template.today("yyyy.mm.dd") %>\n',
sourceMap:true,
sourceMappingURL:'./simplelib.min.js.map'
},
dist: {
files: {
'dist/simplelib.min.js': [
'dist/simplelib.js',
]
}
}
},
clean: {
dist: {
src: [
'dist'
]
}
},
browserify: {
dist: {
src: [ 'src/<%= pkg.name %>.js' ],
dest: 'dist/<%= pkg.name %>.js',
options: {
transform: [['babelify', { presets: "es2015" }]],
browserifyOptions: {
standalone: '<%= pkg.name %>'
}
}
}
},
jshint: {
files: ['./src/*.js'],
options: {
force: true,
esversion: 6,
asi: true,
//strict: 'implied', //true,
browser: true,
expr: true,
laxbreak: true, //allow Bad line breaking [?, :, &&, +...],
validthis: true,
predef: [
"-Promise"
],
globals: {
console: true,
simplelib: true,
module: true
}
}
},
watch: {
options: {
livereload: true
},
files: ['./src/*.js'],
tasks: ['jshint','browserify:dist']
},
connect: {
server: {
options: {
open: true,
protocol: 'http',
hostname: 'localhost',
livereload: true
}
}
}
});
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-browserify');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-connect');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.registerTask('default', ['clean:dist','browserify:dist','uglify']);
grunt.registerTask('devserver', ['jshint', 'browserify:dist', 'connect:server', 'watch']);
}