开发者

How do you compile CoffeeScript in a Jakefile?

I would like to create a Ja开发者_如何学Gokefile which compiles some CoffeeScripts to install a NodeJS application.

How do you do that?

I tried with: https://gist.github.com/1241827

but it's a weak approach, definitely not classy.

Any hints?


Approx snippet I have used:

var fs = require('fs')
var coffee = require('coffee-script')

// If you'd like to see compiled code..
// console.log(coffee.compile(fs.readFileSync('coffee.coffee')))

// ..otherwise
fs.writeFileSync('output.js', coffee.compile(fs.readFileSync('input.coffee')))

..assumes you have the coffee-script node module installed, of course.

Translated from this Cakefile of mine.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜