-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathgruntfile.js
46 lines (41 loc) · 1.33 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
module.exports = function (grunt) {
grunt.initConfig({
// define source files and their destinations
uglify: {
options: { mangle: true },
files: {
src: 'src/lib/*.js', // source files mask
dest: 'build/lib/', // destination folder
expand: true, // allow dynamic building
flatten: true, // remove all unnecessary nesting
ext: '.js' // replace .js to .min.js
}
},
copy: {
main: {
files: [
{ expand: true, flatten: true, src: ['src/manifest.json'], dest: 'build/.' },
{ expand: true, flatten: true, src: ['src/options.html'], dest: 'build/.' },
{ expand: true, flatten: true, src: ['src/options.js'], dest: 'build/.' },
{ expand: true, flatten: true, src: ['src/img/*'], dest: 'build/img/.' }
]
}
},
compress: {
main: {
options: {
archive: 'wpAdminBarHide.zip'
},
files: [
{ cwd: 'build/', flatten: false, expand: true, src: ['**'], dest: '' }
]
}
}
});
// load plugins
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-compress');
// register at least this one task
grunt.registerTask('default', [ 'uglify', 'copy', 'compress' ]);
};