-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathGruntfile.js
82 lines (77 loc) · 2.48 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
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
autoprefixer: {
options: {},
libs: {
src: 'libs/css/*.css'
},
webclient: {
src: 'css/*.css'
}
},
useminPrepare: {
webclient: {
src: ['index.html'],
dest: 'dist/'
}
},
usemin: {
html: 'dist/index.html'
},
cssmin: {
webclient: {
files: {
'dist/css/style.css': 'css/style.css'
}
}
},
htmlmin: {
webclient: {
options: {
removeComments: true,
collapseBooleanAttributes: true,
//collapseWhitespace: true,
//removeAttributeQuotes: true,
//removeRedundantAttributes: true,
//removeOptionalTags: true
},
files: {
'dist/index.html': 'dist/index.html',
'dist/battle.html': 'dist/battle.html',
'dist/teambuilder.html': 'dist/teambuilder.html',
'dist/user_params.html': 'dist/user_params.html'
}
}
},
copy: {
webclient: {
src: ['index.html', 'battle.html', 'teambuilder.html', 'user_params.html', 'images/**'],
dest: 'dist/'
}
}
});
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-cssmin');
grunt.loadNpmTasks('grunt-contrib-htmlmin');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-autoprefixer');
grunt.loadNpmTasks('grunt-usemin');
grunt.registerTask('clean', function () {
grunt.file.delete('.tmp/');
});
grunt.registerTask('min', function () {
grunt.task.run('copy');
grunt.task.run('useminPrepare:webclient');
grunt.config('concat.options.separator', ';');
grunt.task.run('concat');
grunt.task.run('uglify');
grunt.task.run('cssmin');
grunt.task.run('usemin');
grunt.task.run('htmlmin');
grunt.task.run('clean');
});
grunt.registerTask('default', ['autoprefixer']);
grunt.registerTask('optimize', ['autoprefixer', 'min']);
};