Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/dart/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 如何使用gulpinclude插件_Javascript_Gulp - Fatal编程技术网

Javascript 如何使用gulpinclude插件

Javascript 如何使用gulpinclude插件,javascript,gulp,Javascript,Gulp,我有一个项目,我使用gulp作为建筑工具。我想要的是,因为我有两个不同的内容相同的页面,包括页眉,页脚和导航栏html文件在他们。 我的文件夹main index.html位于根文件夹项目中,在那里我还有带有页眉、页脚和导航栏的文件夹部分。我如何设置gulp include,以便使用以下内容: <!DOCTYPE html> <html lang="en"> /*=include partials/header.html */ <body>

我有一个项目,我使用gulp作为建筑工具。我想要的是,因为我有两个不同的内容相同的页面,包括页眉,页脚和导航栏html文件在他们。 我的文件夹main index.html位于根文件夹项目中,在那里我还有带有页眉、页脚和导航栏的文件夹部分。我如何设置gulp include,以便使用以下内容:

<!DOCTYPE html>
<html lang="en">

  /*=include partials/header.html */

  <body>

    /*=include partials/navbar.html */

    <div class="container form-container">
      <div class="row"> 

/*=包含部分/header.html*/
/*=包含部分/navbar.html*/
从将其添加到html中

<!--=include partials/header.html -->  
从添加到您的html

<!--=include partials/header.html -->  
var gulp  = require("gulp"),
include   = require("gulp-include");

gulp.task("include html", function() {
  console.log("-- gulp is including html partials");

  gulp.src("index.html")
    .pipe(include()).on('error', console.log)
    .pipe(gulp.dest("dist"));
});