Question

I'm looking for some middleware modules that allow me to render ".css" from ".scss", ".html" from ".jade", ".js" from ".coffee" on the fly without rendering to disk.

Every module I've encountered so far wants to write to disk before serving it instead of just streaming it.

Obviously this is only for local development since I'm not interested in dealing with file-revving and caching problems.

Was it helpful?

Solution

Answering my own question here:

The middleware to use is compile-middleware. Works fine by default with connect, but with express I had to modify it in order to not write headers (ugly i know, but time waits for no one) : https://github.com/airtonix/compile-middleware

implementation: https://gist.github.com/airtonix/9601224

Original Credit goes to (You should try using this one first): https://github.com/shinohane/compile-middleware

OTHER TIPS

You should simply use a JavaScript task runner like:

Grunt: http://gruntjs.com/ or Gulp: http://gulpjs.com/

These plugins could help you get started (gulp related):

Here's a simple tutorial: http://www.codersgrid.com/2014/01/11/gulp-js-streaming-build-tool-beats-grunt-js/

I got nothing against grunt, both of them are awesome :)

Hope it helps!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top