This repository has been archived by the owner on Jun 13, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Gruntfile.js
executable file
·208 lines (193 loc) · 7.42 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
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
module.exports = function (grunt) {
require('time-grunt')(grunt);
require('jit-grunt')(grunt, {});
grunt.initConfig({
site: {
app: 'app',
dist: 'dist'
},
clean: {
server: {
files: [
{
dot: true,
src: '<%= site.dist %>/*'
}
]
}
},
jekyll: {
options: {
bundleExec: true,
config: '_config.yml',
dest: '<%= site.dist %>',
src: '<%= site.app %>'
},
build: {
options: {
config: '_config.yml,_config.build.yml'
}
},
server: {
options: {
src: '<%= site.app %>'
}
},
check: {
options: {
doctor: true
}
}
},
copy: {
server: {
files: [
{
expand: true,
dot: true,
cwd: '<%= site.app %>',
src: [
'images/**/*'
],
dest: '<%= site.dist %>'
}
]
}
},
less: {
options: {
compress: true
},
build: {},
server: {
options: {
compress: false,
sourceMap: true
},
files: {
'<%= site.dist %>/css/core.css': '<%= site.app %>/_less/core.less'
}
},
test: {}
},
postcss: {
build: {
options: {
map: true,
processors: [
require('autoprefixer')({browsers: 'last 2 versions'}),
require('cssnano')()
]
},
files: [
{
expand: true,
cwd: '<%= site.dist %>/css',
src: '**/*.css',
dest: '<%= site.dist %>/css'
}
]
}
},
connect: {
options: {
hostname: '0.0.0.0',
port: 9051,
middleware: function (connect, options, middlewares) {
middlewares.unshift(function (request, response, next) {
response.setHeader('Access-Control-Allow-Origin', '*');
response.setHeader('Access-Control-Allow-Methods', '*');
return next();
});
return middlewares;
},
useAvailablePort: true
}
},
watch: {
gruntfile: {
files: ['Gruntfile.js'],
options: {
reload: true
}
},
images: {
files: ['<%= site.app %>/images/**/*.*'],
tasks: ['copy:server']
},
less: {
files: ['<%= site.app %>/_less/**/*.less'],
tasks: ['less:server']
},
javascript: {
files: ['<%= site.app %>/_js/**/*.js'],
tasks: ['concat']
},
jekyll: {
files: [
'_*.*',
'<%= site.app %>/**/*.{xml,html,yml,md,mkd,markdown,txt}'
],
tasks: ['jekyll:server', 'concurrent']
}
},
concat: {
options: {
sourceMap: true,
separator: grunt.util.linefeed + ';',
banner: '/*\n @licstart The following is the entire license notice for the\n JavaScript code in this page.\n\n Copyright (C) 2015 Fight for the Future\n\n The JavaScript code in this page is free software: you can\n redistribute it and/or modify it under the terms of the GNU\n General Public License (GNU GPL) as published by the Free Software\n Foundation, either version 3 of the License, or (at your option)\n any later version. The code is distributed WITHOUT ANY WARRANTY;\n without even the implied warranty of MERCHANTABILITY or FITNESS\n FOR A PARTICULAR PURPOSE. See the GNU GPL for more details.\n\n As additional permission under GNU GPL version 3 section 7, you\n may distribute non-source (e.g., minimized or compacted) forms of\n that code without the copy of the GNU GPL normally required by\n section 4, provided you include this license notice and a URL\n through which recipients can access the Corresponding Source.\n\n @licend The above is the entire license notice\n for the JavaScript code in this page.\n*/\n'
},
server: {
files: [
{
src: [
'<%= site.app %>/_js/controllers/**/*.js',
'<%= site.app %>/_js/models/**/*.js',
'<%= site.app %>/_js/views/**/*.js',
'<%= site.app %>/_js/main.js'
],
dest: '<%= site.dist %>/js/core.js'
}
]
}
},
uglify: {
options: {
sourceMap: true,
sourceMapIncludeSources: true,
check: 'gzip',
banner: '/*\n @licstart The following is the entire license notice for the\n JavaScript code in this page.\n\n Copyright (C) 2015 Fight for the Future\n\n The JavaScript code in this page is free software: you can\n redistribute it and/or modify it under the terms of the GNU\n General Public License (GNU GPL) as published by the Free Software\n Foundation, either version 3 of the License, or (at your option)\n any later version. The code is distributed WITHOUT ANY WARRANTY;\n without even the implied warranty of MERCHANTABILITY or FITNESS\n FOR A PARTICULAR PURPOSE. See the GNU GPL for more details.\n\n As additional permission under GNU GPL version 3 section 7, you\n may distribute non-source (e.g., minimized or compacted) forms of\n that code without the copy of the GNU GPL normally required by\n section 4, provided you include this license notice and a URL\n through which recipients can access the Corresponding Source.\n\n @licend The above is the entire license notice\n for the JavaScript code in this page.\n*/\n'
},
build: {
files: {
'<%= site.dist %>/js/core.js': '<%= site.dist %>/js/core.js'
}
}
},
concurrent: {
server: [
'copy:server',
'less:server',
'concat'
]
}
});
grunt.registerTask('dev', [
'clean:server',
'jekyll:server',
'concurrent:server',
'watch'
]);
grunt.registerTask('build', [
'clean:server',
'jekyll:build',
'concurrent:server',
'postcss:build'
]);
grunt.registerTask('test', [
'jekyll:check'
]);
grunt.registerTask('default', [
'dev'
]);
};