Skip to content
This repository has been archived by the owner on Feb 9, 2022. It is now read-only.

Latest commit

 

History

History
67 lines (47 loc) · 1.71 KB

README.md

File metadata and controls

67 lines (47 loc) · 1.71 KB

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