Removes builder.build().
This commit is contained in:
parent
9276d1dcd9
commit
140dd0f15b
41
external/builder/builder.js
vendored
41
external/builder/builder.js
vendored
@ -265,47 +265,6 @@ function preprocessCSS(mode, source, destination) {
|
|||||||
}
|
}
|
||||||
exports.preprocessCSS = preprocessCSS;
|
exports.preprocessCSS = preprocessCSS;
|
||||||
|
|
||||||
/**
|
|
||||||
* Simplifies common build steps.
|
|
||||||
* @param {object} setup
|
|
||||||
* .defines defines for preprocessors
|
|
||||||
* .copy array of arrays of source and destination pairs of files to copy
|
|
||||||
* .preprocess array of arrays of source and destination pairs of files
|
|
||||||
* run through preprocessor.
|
|
||||||
*/
|
|
||||||
function build(setup) {
|
|
||||||
var defines = setup.defines;
|
|
||||||
|
|
||||||
setup.copy.forEach(function(option) {
|
|
||||||
var source = option[0];
|
|
||||||
var destination = option[1];
|
|
||||||
cp('-R', source, destination);
|
|
||||||
});
|
|
||||||
|
|
||||||
setup.preprocess.forEach(function(option) {
|
|
||||||
var sources = option[0];
|
|
||||||
var destination = option[1];
|
|
||||||
|
|
||||||
sources = ls('-R', sources);
|
|
||||||
sources.forEach(function(source) {
|
|
||||||
// ??? Warn if the source is wildcard and dest is file?
|
|
||||||
var destWithFolder = destination;
|
|
||||||
if (test('-d', destination)) {
|
|
||||||
destWithFolder += '/' + path.basename(source);
|
|
||||||
}
|
|
||||||
preprocess(source, destWithFolder, defines);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
(setup.preprocessCSS || []).forEach(function(option) {
|
|
||||||
var mode = option[0];
|
|
||||||
var source = option[1];
|
|
||||||
var destination = option[2];
|
|
||||||
preprocessCSS(mode, source, destination);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
exports.build = build;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Merge two defines arrays. Values in the second param will override values in
|
* Merge two defines arrays. Values in the second param will override values in
|
||||||
* the first.
|
* the first.
|
||||||
|
30
gulpfile.js
30
gulpfile.js
@ -527,15 +527,7 @@ gulp.task('bundle', ['buildnumber'], function () {
|
|||||||
|
|
||||||
function preprocessCSS(source, mode, defines, cleanup) {
|
function preprocessCSS(source, mode, defines, cleanup) {
|
||||||
var outName = getTempFile('~preprocess', '.css');
|
var outName = getTempFile('~preprocess', '.css');
|
||||||
var setup = {
|
builder.preprocessCSS(mode, source, outName);
|
||||||
defines: defines,
|
|
||||||
copy: [],
|
|
||||||
preprocess: [],
|
|
||||||
preprocessCSS: [
|
|
||||||
[mode, source, outName]
|
|
||||||
]
|
|
||||||
};
|
|
||||||
builder.build(setup);
|
|
||||||
var out = fs.readFileSync(outName).toString();
|
var out = fs.readFileSync(outName).toString();
|
||||||
fs.unlinkSync(outName);
|
fs.unlinkSync(outName);
|
||||||
if (cleanup) {
|
if (cleanup) {
|
||||||
@ -550,15 +542,7 @@ function preprocessCSS(source, mode, defines, cleanup) {
|
|||||||
|
|
||||||
function preprocessHTML(source, defines) {
|
function preprocessHTML(source, defines) {
|
||||||
var outName = getTempFile('~preprocess', '.html');
|
var outName = getTempFile('~preprocess', '.html');
|
||||||
var setup = {
|
builder.preprocess(source, outName, defines);
|
||||||
defines: defines,
|
|
||||||
copy: [],
|
|
||||||
preprocess: [
|
|
||||||
[source, outName]
|
|
||||||
],
|
|
||||||
preprocessCSS: []
|
|
||||||
};
|
|
||||||
builder.build(setup);
|
|
||||||
var out = fs.readFileSync(outName).toString();
|
var out = fs.readFileSync(outName).toString();
|
||||||
fs.unlinkSync(outName);
|
fs.unlinkSync(outName);
|
||||||
|
|
||||||
@ -568,15 +552,7 @@ function preprocessHTML(source, defines) {
|
|||||||
|
|
||||||
function preprocessJS(source, defines, cleanup) {
|
function preprocessJS(source, defines, cleanup) {
|
||||||
var outName = getTempFile('~preprocess', '.js');
|
var outName = getTempFile('~preprocess', '.js');
|
||||||
var setup = {
|
builder.preprocess(source, outName, defines);
|
||||||
defines: defines,
|
|
||||||
copy: [],
|
|
||||||
preprocess: [
|
|
||||||
[source, outName]
|
|
||||||
],
|
|
||||||
preprocessCSS: []
|
|
||||||
};
|
|
||||||
builder.build(setup);
|
|
||||||
var out = fs.readFileSync(outName).toString();
|
var out = fs.readFileSync(outName).toString();
|
||||||
fs.unlinkSync(outName);
|
fs.unlinkSync(outName);
|
||||||
if (cleanup) {
|
if (cleanup) {
|
||||||
|
Loading…
Reference in New Issue
Block a user