-
Notifications
You must be signed in to change notification settings - Fork 0
/
gruntfile.js
164 lines (160 loc) · 3.64 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
161
162
163
164
module.exports = function(grunt) {
'use strict';
grunt.initConfig(
{
assemble:
{
extension:
{
options:
{
flatten: true,
partials: ['templates/includes/*.hbs'],
layoutdir: 'templates',
layout: 'extension.hbs',
extension: true,
mobile: false,
order: [[1,5],[2,6],[3,7],[4,8]],
helpers: ['templates/helpers/*.js'],
firstHalf: [1,2,3,4],
secondHalf: [5,6,7,8]
},
files: [
{'dist/extension/' : ['src/*.hbs']},
]
},
mobile:
{
options:
{
flatten: true,
partials: ['templates/includes/*.hbs'],
layoutdir: 'templates',
layout: 'mobile.hbs',
extension: false,
mobile: true,
order: [[1,2],[3,4],[5,6],[7,8]],
helpers: ['templates/helpers/*.js'],
firstHalf: [1,2,3,4],
secondHalf: [5,6,7,8]
},
files: [
{'dist/mobile/' : ['src/*.hbs']},
]
}
},
htmlmin:
{
mobile:
{
options:
{
collapseWhitespace:true,
keepClosingSlash: true,
removeComments:true,
},
files:[
{
expand: true,
cwd: 'dist/mobile',
src: '*.html',
dest: 'dist/mobile'
}]
},
extension:
{
options:
{
collapseWhitespace:true,
keepClosingSlash: true,
removeComments:true,
},
files:[
{
expand: true,
cwd: 'dist/extension',
src: '*.html',
dest: 'dist/extension'
}],
}
},
cssmin:
{
mobile:
{
files:[{
expand: true,
cwd: 'dist/mobile/assets/css',
src: ["*.css"],
dest: 'dist/mobile/assets/css',
ext: '.css'
}]
},
extension:
{
files:[{
expand: true,
cwd: 'dist/extension/assets/css',
src: ["*.css"],
dest: 'dist/extension/assets/css',
ext: '.css'
}]
}
},
uglify:
{
mobile:
{
files:[
{
expand:true,
cwd: 'dist/mobile/assets/js',
src: ["*.js"],
dest: 'dist/mobile/assets/js'
}],
options:{mangle:false}
},
extension:
{
files:[
{
expand:true,
cwd: 'dist/extension/assets/js',
src: ["*.js"],
dest: 'dist/extension/assets/js'
}],
options:{mangle:false}
}
},
copy:
{
extension:
{
files: [
{expand: true, cwd: 'src/assets', src: "**", dest: 'dist/extension/assets', nonull: true},
//{expand: true, cwd: 'src/data', src: "**", dest: 'dist/extension/data', nonull: true},
{expand: true, cwd: 'src', src: "*.json", dest: 'dist/extension/', nonull: true}
]
},
mobile:
{
files: [
{expand: true, cwd: 'src/assets', src: "**", dest: 'dist/mobile/assets', nonull: true},
//{expand: true, cwd: 'src/data', src: "**", dest: 'dist/mobile/data', nonull: true},
{expand: true, cwd: 'src/res', src: "**", dest: 'dist/mobile/res', nonull: true},
{expand: true, cwd: 'src', src: "config.xml", dest: 'dist/mobile/', nonull: true},
{expand: true, cwd: 'src', src: "icon.png", dest: 'dist/mobile/', nonull: true}
]
}
}
});
grunt.loadNpmTasks('assemble');
grunt.loadNpmTasks('grunt-contrib-cssmin');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-htmlmin');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.registerTask('mobile', ['assemble:mobile','copy:mobile','htmlmin:mobile','cssmin:mobile','uglify:mobile']);
grunt.registerTask('extension', ['assemble:extension','copy:extension','htmlmin:extension','cssmin:extension','uglify:extension']);
grunt.registerTask('default', []);
grunt.registerTask('all', ['assemble:extension','copy:extension','htmlmin:extension','cssmin:extension','uglify:extension','assemble:mobile','copy:mobile','htmlmin:mobile','cssmin:mobile','uglify:mobile']);
};