Server Side Includes parser plugin for gulp
Works with both include types
<!--#include file="includes/navigation.html" -->
<!--#include virtual="../templates/navigation.html" -->
And now also correctly interprets directives from the root of a site
<!--#include file="/includes/navigation.html" -->
First, install gulp-ssi
as a development dependency:
npm install --save-dev gulp-ssi
Then, add it to your gulpfile.js
:
var ssi = require("gulp-ssi");
gulp.src("./src/*.ext")
.pipe(ssi())
.pipe(gulp.dest("./dist"));
var ssi = require("gulp-ssi");
gulp.src("./src/*.ext")
.pipe(ssi({root:'/some/path'}))
.pipe(gulp.dest("./dist"));
Type: String
Default: File directory
Set the location where the linked files are hosted. I've preserved this feature to prevent breaking existing clients. It works fine, but it makes assumptions that all relative links eventually resolve to the root of the root directory. So...
With a root of /myroot and an include that looks like
<!--#include file="../../deeper/one.inc" -->
ssi will look for a file at this path:
/myroot/deeper/one.inc.
See the tests for more information. I look forward to better ideas about this.