【发布时间】:2016-06-15 21:29:53
【问题描述】:
我有一个 gulp 任务,它打开一个 index.html 文件并用其他内容替换两个构建/块。我正在使用“gulp-html-replace”:“^1.6.0”
其中一个块没有正确执行替换。
这是 gulp 任务:
gulp.task("html:bundle", ['html:clean', 'html:copy'], function () {
gulp.src('./src/index.html')
.pipe(htmlReplace({
'APPJS': '/DesktopModules/regentsigns-app/dist/app.min.js'
}))
.pipe(gulp.dest('dist/'));
})
这里是需要替换的html块:
<!-- build:APPJS -->
<script>System.import('app').catch(function (err) { console.error(err); });</script>
<!-- endbuild -->
这是结果:
<script src="/DesktopModules/regentsigns-app/dist/app.min.js"></script>
stem.import('app').catch(function (err) { console.error(err); });</script>
<!-- endbuild -->
如您所见,替换会注入新文本,但不会完全删除现有文本。
谁能帮我弄清楚这是为什么?
谢谢
【问题讨论】: