Ai
1 Star 0 Fork 0

ct/parcel-plugin-inline-source

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
index.js 830 Bytes
一键复制 编辑 原始数据 按行查看 历史
ct 提交于 2019-04-20 11:16 +08:00 . 提交代码
const fs = require('fs');
const process = require('process');
const { inlineSource } = require('inline-source');
module.exports = bundler => {
if (process.env.NODE_ENV === 'production') {
bundler.on('bundled', bundle => {
const bundles = Array.from(bundle.childBundles).concat([bundle]);
return Promise.all(
bundles.map(async bundle => {
if (bundle.entryAsset && bundle.entryAsset.type === 'html') {
let html = await inlineSource(bundle.name, {
rootpath: bundle.entryAsset.options.outDir,
htmlpath: bundle.name
});
fs.writeFileSync(bundle.name, html);
}
})
);
});
}
};
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
JavaScript
1
https://gitee.com/ccts/parcel-plugin-inline-source.git
git@gitee.com:ccts/parcel-plugin-inline-source.git
ccts
parcel-plugin-inline-source
parcel-plugin-inline-source
master

搜索帮助