-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGulpfile.js
58 lines (49 loc) · 1.66 KB
/
Gulpfile.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
var gulp = require('gulp');
var panini = require('panini');
var fs = require('fs');
var badgeSourceSettings = JSON.parse(fs.readFileSync('./badgeSourceSettings.json'));
var remoteSrc = require('gulp-remote-src');
var gutil = require('gulp-util');
if (!String.prototype.format) {
String.prototype.format = function() {
var args = arguments;
return this.replace(/{(\d+)}/g, function(match, number) {
return typeof args[number] != 'undefined' ?
args[number] :
match;
});
};
}
function getBadgeSources() {
var sources = [];
badgeSourceSettings.countryCodes.forEach(function(element) {
sources.push(badgeSourceSettings.filenameFormat.format(element, badgeSourceSettings.extension));
}, this);
return sources;
}
gulp.task('download-badges', function() {
remoteSrc(getBadgeSources(), {
base: badgeSourceSettings.baseUrl,
requestOptions: {
'proxy': "http://shsl:s987123H%[email protected]:8080"
}
})
.pipe(gulp.dest('./src/img/eps'));
});
gulp.task('test', function(cb) {
var sb = '';
badgeSourceSettings.countryCodes.forEach(function(entry) {
sb += '- "' + entry + '"\r\n';
});
fs.writeFile('test/panini/data/languages.yml', sb, cb);
gulp.src('test/panini/pages/**/*.html')
.pipe(panini({
root: 'test/panini/pages/',
layouts: 'test/panini/layouts/',
partials: 'test/panini/partials/',
helpers: 'test/panini/helpers/',
data: 'test/panini/data/'
}))
.pipe(gulp.dest('test'));
});
gulp.task('default', ['test']);