-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGruntfile.js
126 lines (123 loc) · 3.7 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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
//noinspection JSLint
module.exports = function (grunt) {
'use strict';
//noinspection JSUnresolvedFunction
grunt.initConfig({
copy: {
main: {
files: [
{
expand: true,
cwd: 'bower_components/jquery/dist/',
src: '**',
dest: 'dist/js/libs/'
},
{
expand: true,
cwd: 'bower_components/mustache.js/',
src: 'mustache.js',
dest: 'dist/js/libs/'
},
{
expand: true,
cwd: 'static/img/',
src: '**',
dest: 'dist/img/'
},
{
expand: true,
cwd: 'src/js/',
src: '**',
dest: 'dist/js/'
},
{
expand: true,
cwd: 'static/',
src: 'favicon.ico',
dest: 'dist/'
},
{
expand: true,
cwd: 'src/html/',
src: '**',
dest: 'dist/'
}
]
},
html: {
expand: true,
cwd: 'src/html/',
src: '**',
dest: 'dist/'
},
js: {
expand: true,
cwd: 'src/js/',
src: '**',
dest: 'dist/js/'
},
publish: {
expand: true,
cwd: 'dist/',
src: '**',
dest: 'gh-pages/'
}
},
uglify: {
options: {
sourceMap: true
},
main: {
src: 'dist/js/main.js',
dest: 'dist/js/main.min.js'
},
libs: {
src: 'dist/js/libs/mustache.js',
dest: 'dist/js/libs/mustache.min.js'
}
},
less: {
options: {
cleancss: true
},
main: {
src: 'src/less/main.less',
dest: 'dist/css/main.min.css'
}
},
autoprefixer: {
options: {
browsers: ['> 5%', 'last 2 versions']
},
main: {
src: 'dist/css/main.min.css',
dest: 'dist/css/main.min.css'
}
},
watch: {
js: {
files: 'src/js//*.js',
tasks: ['copy:js', 'uglify:main']
},
css: {
files: 'src/less/main.less',
tasks: ['less', 'autoprefixer']
},
html: {
files: 'src/html/index.html',
tasks: ['copy:html']
}
}
});
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-less');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-autoprefixer');
grunt.registerTask('default', ['copy:main', 'uglify', 'less', 'autoprefixer']);
grunt.registerTask('js', ['copy:js', 'uglify:main']);
grunt.registerTask('css', ['less', 'autoprefixer']);
grunt.registerTask('html', ['copy:html']);
grunt.registerTask('publish', ['copy:publish']);
grunt.registerTask('dev', ['watch']);
};