-
Notifications
You must be signed in to change notification settings - Fork 2
/
Gruntfile.js
92 lines (80 loc) · 2.37 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
82
83
84
85
86
87
88
89
90
91
92
module.exports = function(grunt) {
var config = {
// Clean folders ================================
clean: {
dev: ['public/vanilla-masker*'],
build: ['build/vanilla-masker*']
},
// Concat ========================================
concat: {
options: {
separator: ";"
},
dev: {
src: ["lib/vanilla-masker.js"],
dest: "public/vanilla-masker.js"
},
build: {
src: ["lib/vanilla-masker.js"],
dest: "build/vanilla-masker.min.js"
}
},
// Jasmine Runner ================================
jasmine: {
dev: {
src: ['lib/vanilla-masker.js'],
options: {
specs: 'tests/*_spec.js'
}
}
},
// JSHint ========================================
jshint: {
all: ["lib/vanilla-masker.js"]
},
// Minification ==================================
uglify: {
minify: {
files: {
"build/vanilla-masker.min.js": ["build/vanilla-masker.min.js"]
}
}
},
// Compress ======================================
compress: {
build: {
options: { mode: 'gzip', level: 9, pretty: true },
files: [
{expand: true, flatten: true, src: ['build/*.js'], dest: 'build', ext: '.min.js.gz'}
]
}
},
// Connect Server ================================
connect: {
dev: {
options: { port: 4500, base: 'public' }
}
},
// Watch Files ===================================
watch: {
livereload: {
options: { livereload: true },
files: ['lib/*', 'tests/*', 'Gruntfile.js', 'package.json'],
tasks: ['default']
}
}
};
grunt.initConfig(config);
grunt.loadNpmTasks("grunt-contrib-clean");
grunt.loadNpmTasks("grunt-contrib-concat");
grunt.loadNpmTasks("grunt-contrib-jshint");
grunt.loadNpmTasks("grunt-contrib-uglify");
grunt.loadNpmTasks("grunt-contrib-jasmine");
grunt.loadNpmTasks('grunt-contrib-compress');
grunt.loadNpmTasks('grunt-contrib-connect');
grunt.loadNpmTasks("grunt-contrib-watch");
grunt.registerTask("default", ["jshint", "jasmine:dev"]);
grunt.registerTask("test", ["default"]);
grunt.registerTask("dev", ["default", "clean:dev", "concat:dev", "connect", "watch"]);
grunt.registerTask("build", ["default", "clean:build", "concat:build", "uglify", "compress"]);
};