UNPKG

gulp-build-html

Version:

Used to process html files to automatically concat css and js files, and meanwhile update html references.

28 lines (25 loc) 1.48 kB
var implement1 = require("./blockParserAndBuilder1"), implement2 = require("./blockParserAndBuilder2"); /** * 执行构建动作 * @param {String} fileContent 文件正文 * @param {String} fileAbsolutePath 文件的绝对路径 * @param {Object} [ops] 控制选项 * @param {GeneratedFileInstaller} [ops.generatedCssFileInstaller] 生成的css文件的安装器。当输出目标是 file 时有用。不影响文件的自动生成。 * @param {GeneratedFileInstaller} [ops.generatedJsFileInstaller] 生成的js文件的安装器。当输出目标是 file 时有用。不影响文件的自动生成。 * @param {GeneratedContentInstaller} [ops.generatedCssContentInstaller] 生成的css正文的安装器。当输出目标是 inline 时有用 * @param {GeneratedContentInstaller} [ops.generatedJsContentInstaller] 生成的js正文的安装器。当输出目标是 inline 时有用 * @param {BuildCompleteListener} [ops.oncomplete] 构建完成后要执行的方法 * @returns {{newFileContent: String, generatedVinylFiles: Vinyl[]}} 生成的vinyl文件实例集合 */ var build = function(fileContent, fileAbsolutePath, ops){ var rst1 = implement1.build(fileContent, fileAbsolutePath, ops); var rst2 = implement2.build(rst1.newFileContent, fileAbsolutePath, ops); return { newFileContent: rst2.newFileContent, generatedVinylFiles: rst1.generatedVinylFiles.concat(rst2.generatedVinylFiles) }; }; module.exports = { build: build };