6
我想创建一个Jakefile来编译一些CoffeeScripts来安装NodeJS应用程序。如何在Jakefile中编译CoffeeScript?
你是怎么做的?
我试着用: https://gist.github.com/1241827
但它是一个弱的做法,绝对不是优雅。
任何提示?
我想创建一个Jakefile来编译一些CoffeeScripts来安装NodeJS应用程序。如何在Jakefile中编译CoffeeScript?
你是怎么做的?
我试着用: https://gist.github.com/1241827
但它是一个弱的做法,绝对不是优雅。
任何提示?
约片断我用:
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你当然有安装coffee-script
节点模块中。
从这个Cakefile我的翻译。
我已经有了一起来看看咖啡.compile()方法,但我不知道是否有办法不使用FS。 无论如何,谢谢,我会用这个片段! – odino