Serving SSI content with Grunt and Connect

Having recently tried to search for the answer to this question, and found that one guy had partially answered the question on every post, here’s how to serve SSI / SHTML content through Grunt and Express.

The Grunt Task

Pretty straight forward, add connect with a server. Change the port and hostname as per your requirements. ‘express-keepalive’ keeps the Grunt task, and hence the server, running.

The server

Hopefully the gist below is self explanitory, we’re using connect-ssi as the wrapper for node-ssi. Be sure to add the dependencies to your package JSON.

Possible problem

When I came to use connect-ssi and node-ssi the includes didn’t work the same as in MAMP/WAMP. The definitions for the file and virtual declaration seem the wrong way around. I’ve forked node-ssi here if you’re having a similar issue.

Filed under: Uncategorised