-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathGruntfile.js
64 lines (51 loc) · 1.77 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
module.exports = function(grunt) {
grunt.file.defaultEncoding = 'utf8';
grunt.file.preserveBOM = true;
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-cssmin');
var pkg = grunt.file.readJSON('package.json');
var dancer = grunt.file.readYAML('config.yml');
var js_build_path = dancer.assets.js['build-folder'] + '/' + dancer.assets.js['build-file'];
var js_build_min_path = dancer.assets.js['build-folder'] + '/' + dancer.assets.js['build-file-min'];
var css_build_path = dancer.assets.css['build-folder'] + '/' + dancer.assets.css['build-file'];
var css_build_min_path = dancer.assets.css['build-folder'] + '/' + dancer.assets.css['build-file-min'];
grunt.initConfig({
pkg: pkg,
clean: {
build: [dancer.assets.js['build-folder'], dancer.assets.css['build-folder']],
},
concat: {
js: {
src: dancer.assets.js.files,
dest: js_build_path
},
css: {
src: dancer.assets.css.files,
dest: css_build_path
}
},
uglify: {
js: {
options: {
banner: '/*! <%= pkg.name %> <%= grunt.template.today("yyyy-mm-dd") %> */\n',
report: 'min'
},
src: js_build_path,
dest: js_build_min_path
}
},
cssmin: {
css: {
options: {
banner: '/*! <%= pkg.name %> <%= grunt.template.today("yyyy-mm-dd") %> */\n',
report: 'min'
},
src: css_build_path,
dest: css_build_min_path
}
}
});
grunt.registerTask('default', ['clean','concat','uglify','cssmin']);
};