Socket
Socket
Sign inDemoInstall

connect-ssi

Package Overview
Dependencies
6
Maintainers
2
Versions
11
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    connect-ssi

SSI (Server Side Includes) Middleware for Connect and Express


Version published
Weekly downloads
485
decreased by-16.23%
Maintainers
2
Install size
146 kB
Created
Weekly downloads
 

Readme

Source

connect-ssi

SSI (Server Side Includes) Middleware for Connect and Express

Install

npm install connect-ssi

Examples

In your .shtml file

Uses node-ssi under the hood, supports all of the following:

<!--# include file="path" -->

<!--# set var="k" value="v" -->

<!--# echo var="n" default="default" -->

<!--# if expr="test" -->
<!--# elif expr="" -->
<!--# else -->
<!--# endif -->

Next, wire it up to Connect or Express like so:

Using gulp-connect

gulp.task('connect', connect.server({
    root: ['app'],
    middleware: function() {
        return [connectSSI({
            baseDir: __dirname + '/app'
        })];
    }
}));

Using Express

var connectSSI = require('connect-ssi')
app.use(connectSSI({
    baseDir: __dirname + '/public'
}));

Using grunt-contrib-connect version 0.9.0 or greater

var connectSSI = require('connect-ssi');

and then inside the grunt.initConfig

connect: {
    options: {
        middleware: function(connect, options, middlewares) {
			if (!Array.isArray(options.base)) {
				options.base = [options.base];
			}
			var directory = options.directory || options.base[options.base.length - 1];

			middlewares.unshift(connectSSI({
				baseDir: directory,
				ext: '.html'
			}));                
            return middlewares;
        }
    }
}

Configuration

{
    ext: '.shtml', // file extension. Only urls ending in this will be evaluated.
    baseDir: __dirname // base path to look in for files
}

All config options are passed to node-ssi so,any additional options that it supports (such as payload) may be added to the configuration object.

Keywords

FAQs

Last updated on 24 Jan 2017

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc