forked from MindTouch/gulp-ckbuilder
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
24 lines (24 loc) · 718 Bytes
/
index.js
File metadata and controls
24 lines (24 loc) · 718 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
'use strict';
var PluginError = require('gulp-util').PluginError;
var through = require('through2');
var ckbuilder = require('node-ckbuilder');
var pluginName = 'gulp-ckbuilder';
module.exports = function(src, dest, opts) {
if(!src) {
return cb(new PluginError(pluginName, 'CKEditor sources path is required'));
}
if(!dest) {
return cb(new PluginError(pluginName, 'CKEditor release destination path is required'));
}
Object.assign(ckbuilder.options, opts || {});
var builder = ckbuilder.builder(src, dest);
return through.obj(function(chunk, enc, cb) {
try {
builder.generateBuild();
this.push(chunk);
} catch (err) {
this.emit('error', new PluginError(pluginName, err));
}
cb();
});
};