Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

connect-ssi

Package Overview
Dependencies
Maintainers
2
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

connect-ssi

SSI (Server Side Includes) Middleware for Connect and Express

  • 1.1.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
393
decreased by-10.48%
Maintainers
2
Weekly downloads
 
Created
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

Package last updated on 24 Jan 2017

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc