-
Notifications
You must be signed in to change notification settings - Fork 1
/
Gruntfile.js
160 lines (159 loc) · 5.61 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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
module.exports = function (grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
clean: {
build: {
src: 'build/*'
},
fonts: {
src: 'source/fonts/*'
}
},
copy: {
bootstrap: {
cwd: 'source/bower/bootstrap/fonts/',
src: '**',
dest: 'source/fonts/',
expand: true,
flatten: true,
filter: 'isFile'
},
font_awesome: {
cwd: 'source/bower/font-awesome/fonts/',
src: '**',
dest: 'source/fonts/',
expand: true,
flatten: true,
filter: 'isFile'
},
fonts_dist: {
cwd: 'source/fonts/',
src: '**',
dest: 'build/fonts/',
expand: true,
flatten: true,
filter: 'isFile'
},
img_calculated_dist: {
cwd: 'source/img/calculated/',
src: '**',
dest: 'build/img/calculated/',
expand: true,
flatten: true,
filter: 'isFile'
},
img_samples_dist: {
cwd: 'source/img/samples/',
src: '**',
dest: 'build/img/samples/',
expand: true,
flatten: true,
filter: 'isFile'
},
favicon_dist: {
cwd: 'source/',
src: 'favicon.ico',
dest: 'build/',
expand: true,
flatten: true,
filter: 'isFile'
},
tgif_dist: {
cwd: 'source/img/',
src: 't.gif',
dest: 'build/img/',
expand: true,
flatten: true,
filter: 'isFile'
}
},
processhtml: {
index: {
files: {
'build/index.html': 'source/index.html',
'build/404.html': 'source/404.html',
'build/500.html': 'source/500.html'
}
}
},
htmlmin: {
index: {
options: {
removeComments: true,
removeEmptyAttributes: true,
collapseWhitespace: true,
useShortDoctype: true
},
files: {
'build/index.html': 'build/index.html',
'build/404.html': 'build/404.html',
'build/500.html': 'build/500.html'
}
}
},
less: {
dist: {
options: {
paths: ["source/css"],
cleancss: {
keepSpecialComments: 0
},
compress: true
},
files: {
"build/css/app.min.css": [
"source/bower/bootstrap/dist/css/bootstrap.css",
"source/bower/bootstrap/dist/css/bootstrap-theme.css",
"source/css/colorpicker2.less",
"source/css/app.less"
],
"build/css/error.min.css": "source/css/error.less"
}
}
},
uglify: {
dist: {
options: {
/*mangle: {
except: ['jQuery', 'Backbone']
},*/
drop_console: true
},
files: {
'build/js/app.min.js': [
'source/bower/jquery/dist/jquery.min.js',
'source/js/jquery-ui-1.10.3.custom.js',
'source/bower/FileSaver/FileSaver.js',
'source/bower/json2/json2.js',
'source/bower/underscore/underscore.js',
'source/bower/backbone/backbone.js',
'source/bower/bootstrap/dist/js/bootstrap.min.js',
'source/bower/fabric/dist/fabric.min.js',
'source/js/app/const.js',
'source/js/app/utils.js',
'source/js/app/slider.js',
'source/js/app/canvas.js',
'source/js/app/colorpicker/model.js',
'source/js/app/colorpicker/view.js',
'source/js/app/sample/view.js',
'source/js/app/sample/model.js',
'source/js/app/sample/collection.js',
'source/js/app/library/model.js',
'source/js/app/library/view.js',
'source/js/app/library/collection.js',
'source/js/app/ui-handlers.js',
'source/js/app/app.js'
]
}
}
}
});
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-htmlmin');
grunt.loadNpmTasks('grunt-contrib-less');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-processhtml');
grunt.registerTask('copy fonts', ['clean:fonts', 'copy:bootstrap', 'copy:font_awesome']);
grunt.registerTask('default', ['clean:build', 'copy', 'processhtml:index', 'htmlmin:index', 'less:dist', 'uglify:dist']);
};