diff --git a/build/helper.js b/build/helper.js index b93b17bca..e58077012 100644 --- a/build/helper.js +++ b/build/helper.js @@ -146,10 +146,11 @@ exports.travelSrcDir = function (srcDir, cb) { * @param {string} [opt] * @param {string} [opt.inputPath] Absolute input path. * @param {string} [opt.outputPath] Absolute output path. + * @param {string} [opt.preamble] * @param {Function} [opt.transform] * @param {Function} [opt.reserveDEV] */ -exports.prePulishSrc = function ({inputPath, outputPath, transform, reserveDEV}) { +exports.prePulishSrc = function ({inputPath, outputPath, preamble, transform, reserveDEV}) { assert(inputPath && outputPath); console.log( @@ -173,6 +174,10 @@ exports.prePulishSrc = function ({inputPath, outputPath, transform, reserveDEV}) code = transform({code, inputPath, outputPath}); } + if (preamble) { + code = preamble + code; + } + fsExtra.ensureFileSync(outputPath); fs.writeFileSync(outputPath, code, {encoding:'utf-8'}); };