Adds SSI-style include functionality to connect/grunt
A node conect middleware component to support shtml-style includes.
For example, the following in an html file:
<!-- #include file="test.html" -->
will be replaced with the contents of test.html. Note that only the file= directive is supported; virtual= will be ignored.
To install, do the following
npm install connect-include --save
Then include as a middleware component to connect:
var include = require'connect-include';connectuseinclude'/my/web/root';
If you're using Grunt, include as follows in
// load all grunt tasksrequire'matchdep'filterDev'grunt-*'forEachgruntloadNpmTasks;// include connect-includevar ssInclude = require"connect-include";gruntinitConfig// ...connect:// ...livereload:options:// Same as in grunt-contrib-connectvar middlewares = ;var directory = optionsdirectory || optionsbaseoptionsbaselength - 1;if !ArrayisArrayoptionsbaseoptionsbase = optionsbase;// Here we insert connect-include, use the same pattern to add other middlewaremiddlewarespushssIncludedirectory;// Same as in grunt-contrib-connectoptionsbaseforEachmiddlewarespushconnectstaticbase;;middlewarespushconnectdirectorydirectory;return middlewares;// ...