-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGruntFile.js
78 lines (76 loc) · 1.54 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
module.exports = function (grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
jison: {
options: {
moduleType: 'js'
},
dist: {
files: {
'src/30_parser.js': 'src/30_parser.jison'
}
}
},
concat: {
options: {
separator: '\n'
},
dist: {
src: require("glob").sync("./src/*.js"),
dest: 'dist/units.pre.js'
}
},
uglify: {
options: {
report: "gzip",
sourceMap: true,
preserveComments: false,
banner: '/*! <%= pkg.name %> <%= grunt.template.today("dd-mm-yyyy") %> */\n'
},
dist: {
files: {
'dist/units.min.js': ['dist/units.pre.js']
}
},
distBeautify: {
options: {
sourceMap: false,
mangle: false,
beautify: true
},
files: {
'dist/units.js': ['dist/units.pre.js']
}
}
},
watch: {
options: {
atBegin: true,
spawn: false
},
dev: {
files: ['src/**.jison', 'src/**.js'],
tasks: ['dev']
}
},
blanket_mocha: {
dist: {
src: ['test/*.html'],
options: {
threshold: 50,
log: true,
logErrors: true
}
}
}
});
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-jison');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-blanket-mocha');
grunt.registerTask('test', ['blanket_mocha']);
grunt.registerTask('dev', ['jison', 'concat', 'blanket_mocha']);
grunt.registerTask('dist', ['jison', 'concat', 'uglify', 'blanket_mocha']);
grunt.registerTask('default', ['dist']);
};