2011-09-26 17 views

Trả lời

3

đoạn Khoảng Tôi đã sử dụng:

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 bạn có module coffee-script nút cài đặt, tất nhiên.

Được dịch từ số Cakefile của tôi.

+0

Tôi đã xem xét phương thức cà phê .compile(), nhưng tôi đã tự hỏi liệu có cách nào không sử dụng FS không. Dù sao, cảm ơn, tôi sẽ sử dụng đoạn mã này! – odino

Các vấn đề liên quan