Connection middleware for coffeescript?

Yes, I know connect-assets . But I hope coffeescript files can be compiled on request. As with stylus middleware.

 app.use(stylus.middleware( src: __dirname + "/assets", dest: __dirname + "/public" )) 

So ... is there anything that works this way?

EDIT : I know connect.compiler too. But it was removed in the latest version of connect .

+6
source share
2 answers

I just posted a new module, npm install connect-coffee-script , which does just that. Submitted documentation and sample, as well as article .

Here is an example from readme:

  var coffeescript = require('connect-coffee-script'); var connect = require('connect'); var app = connect(); app.use(coffeescript({ src: __dirname, dest: __dirname + '/public', bare: true })); app.use(connect.static(__dirname + '/public')); app.listen(3000) 
+6
source
 app.use(express.compiler({ src: __dirname + "/assets", dest: __dirname + "/public", enable: ['coffeescript'] })); 

can also add a stylus to the enable array if you use both of these files.

im using expression 2.5.9

+1
source

Source: https://habr.com/ru/post/920830/


All Articles