-
Notifications
You must be signed in to change notification settings - Fork 279
Expand file tree
/
Copy pathbuild.js
More file actions
68 lines (58 loc) · 1.7 KB
/
build.js
File metadata and controls
68 lines (58 loc) · 1.7 KB
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
const gulp = require('gulp');
const argv = require('yargs').argv;
const Constants = require('../constants');
const del = require('del');
const fs = require('fs');
const path = require('path');
const runSequence = require('run-sequence');
const template = require('gulp-template');
gulp.task('build', function(callback) {
const task = ['build-demo', 'post-cleanup'];
if (argv.release) {
task.push('minimize-css');
}
runSequence(
'clean-dist',
[
'build-css',
'copy-ckeditor',
'copy-languages',
'copy-svgs'
],
task,
callback
);
});
gulp.task('clean-dist', function(callback) {
del(Constants.distFolder, {force: true}).then(function() {
callback();
});
});
gulp.task('build-demo', function() {
var templateHead;
if (argv.release) {
templateHead = 'head-release.template';
} else {
templateHead = 'head-dev.template';
}
return gulp.src([
path.join('./demo', 'index.html')
])
.pipe(template({
resources: fs.readFileSync(path.join('./template', templateHead)).toString()
}))
.pipe(gulp.dest(path.join(Constants.distFolder)));
});
gulp.task('copy-ckeditor', function() {
return gulp.src(path.join(Constants.rootDir, 'lib', 'ckeditor', '/**'))
.pipe(gulp.dest(Constants.editorDistFolder));
});
gulp.task('post-cleanup', function(callback) {
del([
path.join(Constants.editorDistFolder, 'adapters'),
path.join(Constants.editorDistFolder, 'CHANGES.md'),
path.join(Constants.editorDistFolder, 'samples')
], {force: true}).then(function() {
callback();
});
});