the connect middleware for coffeescript?
Asked Answered
T

2

6

Yes I know connect-assets. But I hope the coffeescript files can be compiled on request. Just like in stylus middleware.

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

So, is there anything that works this way?

I know connect.compiler too. But it has been removed in newest version of connect.

Thousand answered 18/7, 2012 at 20:7 Comment(0)
G
6

I've just published a new module, npm install connect-coffee-script, which does just that. Documentation and a sample are provided as well as an introduction article.

Here's an exemple from the 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)
Grunt answered 24/7, 2012 at 12:30 Comment(1)
does this work with express? It doesnt seem to be working with the express static asset server for meHeroworship
D
1
app.use(express.compiler({
  src: __dirname + "/assets",
  dest: __dirname + "/public",
  enable: ['coffeescript']
}));

could also add stylus to the enable array if you are using both!

im using express 2.5.9

Drinkwater answered 18/7, 2012 at 20:16 Comment(1)
I believe it's deprecated and will be removed in the future.Thousand

© 2022 - 2024 — McMap. All rights reserved.