【问题标题】:Getting gulp-file-include and browser-sync to work together让 gulp-file-include 和 browser-sync 一起工作
【发布时间】:2014-07-29 00:52:34
【问题描述】:

我在blog 中读到,您可以使用gulp-file-include 来包含 .html 文件,它可以工作,但下面的代码最终会覆盖 html 中的包含标记...

你可能会想为什么我没有gulp-file-include 吐出到另一个目标文件夹?原因是之后我无法获得浏览器同步来刷新浏览器。本质上,这个link 说明了我的问题......

看起来应该有另一个“输出”文件夹,它将所有包含的内容提炼到一个新的 .index.html 文件中

我知道我可以打开接收包含的文件,然后 browserSync 就可以工作,但这不是额外的步骤吗?

请提出问题,因为这看起来很简单!

gulp.task('fileinclude', function() {
  gulp.src('builds/development/*.html')
  .pipe(fileinclude())
  .pipe(gulp.dest('builds/development/'));
});

【问题讨论】:

  • 我添加了node.js 标签,这看起来很相关,可能会给你带来更多的读者。

标签: html node.js gulp


【解决方案1】:

原来我没有将fileinclude 包含在我的watch 任务中...

对于任何想要了解我的结果的人,请查看我的要点...

https://gist.github.com/antonioOrtiz/2bf2e27b8e0a23115034

【讨论】:

    猜你喜欢
    • 2017-05-15
    • 2016-01-28
    • 1970-01-01
    • 2023-03-14
    • 1970-01-01
    • 2020-10-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多