문제

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.

도움이 되었습니까?

해결책

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

다른 팁

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!

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top