-
Notifications
You must be signed in to change notification settings - Fork 245
/
Copy pathGruntfile.js
226 lines (213 loc) · 4.08 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
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
module.exports = function(grunt) {
require('load-grunt-tasks')(grunt);
require('time-grunt')(grunt);
grunt.initConfig({
sass: {
task: {
files: [{
expand: true,
cwd: 'styles',
src: [
'screen.scss',
'search.scss'
],
dest: 'styles',
ext: '.css'
}]
}
},
cssmin: {
task: {
files: [{
expand: true,
cwd: 'styles',
src: '*.css',
dest: 'styles'
}]
}
},
autoprefixer: {
task: {
src: 'styles/*.css'
}
},
jekyll: {
full: {
//
},
limit: {
options: {
limit_posts: 150
}
}
},
htmlmin: {
html: {
options: {
removeComments: true,
collapseWhitespace: true
},
expand: true,
cwd: '_site/',
src: [
'**/index.html',
'errors/*.html'
],
dest: '_site/'
},
xml: {
options: {
collapseWhitespace: true,
keepClosingSlash: true
},
expand: true,
cwd: '_site/feed/',
src: '**/index.xml',
dest: '_site/feed/'
}
},
beml: {
options: {
elemPrefix: '__',
modPrefix: '--'
},
files: {
expand: true,
cwd: '_site/',
src: [
'**/index.html',
'errors/*.html'
],
dest: '_site/'
}
},
connect: {
task: {
options: {
base: '_site',
port: 33310,
livereload: true,
open: true
}
}
},
watch: {
styles: {
files: 'styles/*.scss',
tasks: [
'styles',
'copy'
]
},
limit: {
files: [
'**',
'!.git/**',
'!.sass-cache/**',
'!_scripts/**',
'!_site/**',
'!CONTRIBUTING.md',
'!LICENSE.md',
'!README.md',
'!Gruntfile.js',
'!node_modules/**',
'!package.json',
'!install.sh',
'!styles/*',
'!{articles,blog,tv}/**',
'{articles,blog,tv}/index.html',
'{articles,blog,tv}/**/_posts/*.md'
],
tasks: [
'jekyll:limit',
'html'
]
},
livereload: {
options: {
livereload: true
},
files: [
'_site/**/*.html',
'_site/styles/*.css'
]
}
},
copy: {
task: {
files: [{
expand: true,
src: 'styles/*.css',
dest: '_site/'
}]
}
},
replace: {
task: {
src: '.htaccess',
dest: '_site/',
replacements: [{
// Redirect all traffic to https://dev.opera.com/*
from: 'RewriteEngine On\n\n',
to: 'RewriteEngine On\n\nRewriteCond %{HTTP_HOST} !^dev\\.opera\\.com [NC]\nRewriteRule ^(.*)$ https://dev.opera.com%{REQUEST_URI} [R=301,L]\n\nRewriteCond %{HTTPS} off\nRewriteRule ^(.*)$ https://dev.opera.com%{REQUEST_URI} [R=301,L]\n\n'
}]
}
},
rsync: {
options: {
args: [
'--checksum', // skip based on checksum, not mod-time & size
'--chmod=ug=rwX,o=rX', // `chmod` new files
'--compress', // compress data during the transfer
// Note: the next line is commented out to avoid deleting the
// `extension-docs` directory, which is generated from a separate
// repository at the moment. As soon as the extension docs are merged
// with the main `devopera` repository, we should re-enable it.
//'--delete', // delete extraneous files on the receiving side
'--human-readable', // output numbers in a human-readable format
'--itemize-changes', // output a change-summary for all updates
'--omit-dir-times', // …except for directories
'--progress', // show progress during transfer
'--stats', // show some file-transfer stats
'--times', // preserve modification times…
'--verbose' // increase verbosity
],
exclude: ['.DS_Store'],
recursive: true
},
deploy: {
options: {
src: '_site/',
dest: '/var/www/html/',
host: '54.213.240.91'
}
}
}
});
grunt.registerTask('styles', [
'sass',
'autoprefixer',
'cssmin'
]);
grunt.registerTask('html', [
'htmlmin',
'beml'
]);
grunt.registerTask('default', [
'styles',
'jekyll:limit',
'html',
'connect',
'watch'
]);
grunt.registerTask('build', [
'styles',
'jekyll:full',
'html',
'connect:task:keepalive'
]);
grunt.registerTask('deploy', [
'replace',
'rsync'
]);
};