-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathgulpfile.js
108 lines (98 loc) · 2.97 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
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
var gulp = require('gulp'),
ejs = require('gulp-ejs'),
concat = require('gulp-concat'),
marked = require('gulp-marked'),
browser = require('gulp-browserify'),
uglify = require('gulp-uglify'),
fs = require('fs'),
path = require('path'),
clean = require('del'),
pkgInfo = require('./package.json'),
CLOBBER = [];
gulp.task('clobber', function (done) {
clean(CLOBBER, done);
});
gulp.task('readme.md', function () {
var dir = 'src/tmpl/readme/en';
return gulp.
src([
'HEADER.ejs',
'SUMMARY.ejs',
'USAGE.ejs',
'I18N.ejs',
// 'DOCUMENTATION.ejs',
// 'DEPENDENCIES.ejs',
'ISSUES.ejs',
'LICENSE.ejs'
].map(function (file) { return path.join(dir, file); })).
pipe(ejs({
pkg: pkgInfo,
license: fs.readFileSync('LICENSE', 'utf8'),
links: {
apiDoc: 'API.md'
}
})).
pipe(concat('README.md')).
pipe(gulp.dest('./'));
});
CLOBBER.push('README.md');
gulp.task('readme.de.md', function () {
var dir = 'src/tmpl/readme/de';
return gulp.
src([
'HEADER.ejs',
'SUMMARY.ejs',
'USAGE.ejs',
'I18N.ejs',
// 'DOCUMENTATION.ejs',
// 'DEPENDENCIES.ejs',
'ISSUES.ejs',
'LICENSE.ejs'
].map(function (file) { return path.join(dir, file); })).
pipe(ejs({
pkg: pkgInfo,
license: fs.readFileSync('LICENSE', 'utf8'),
links: {
apiDoc: 'API.md'
}
})).
pipe(concat('README.de.md')).
pipe(gulp.dest('./'));
});
CLOBBER.push('README.de.md');
gulp.task('readme', ['readme.md', 'readme.de.md']);
gulp.task('readme.html', ['readme.md'], function () {
return gulp.src('README.md').
pipe(marked()).
pipe(concat('README.html')).
pipe(gulp.dest('./'));
});
CLOBBER.push('README.html');
gulp.task('js-aurebesh', function () {
return gulp.src('./lib/aurebesh/form.js').
pipe(browser()).
pipe(concat('aurebesh-batch.js')).
pipe(uglify()).
pipe(gulp.dest('./pub/js'));
});
gulp.task('js-imperial', function () {
return gulp.src('./lib/imperial/form.js').
pipe(browser()).
pipe(concat('imperial-batch.js')).
pipe(uglify()).
pipe(gulp.dest('./pub/js'));
});
gulp.task('i18n', function () {
return gulp.src('./lib/illustrator/index.js').
pipe(browser({
require:
fs.
readdirSync('lib/i18n/strings').
filter(function (f) { return f.indexOf('index') === -1; }).
map(function (f) { return 'lib/i18n/strings/' + f; })
})).
pipe(concat('i18n.js')).
pipe(gulp.dest('pub/js'));
});
gulp.task('js', ['js-aurebesh', 'js-imperial']);
gulp.task('default', ['js', 'readme']);