gulp-ssi

0.1.5 • Public • Published

gulp-ssi

NPM version Build Status

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" -->

Usage

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"));

Options

var ssi = require("gulp-ssi");
 
gulp.src("./src/*.ext")
    .pipe(ssi({root:'/some/path'}))
    .pipe(gulp.dest("./dist"));

root (optional)

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.

License

MIT License

/gulp-ssi/

    Package Sidebar

    Install

    npm i gulp-ssi

    Weekly Downloads

    16

    Version

    0.1.5

    License

    MIT

    Unpacked Size

    12.9 kB

    Total Files

    13

    Last publish

    Collaborators

    • etylsarin