javascript - 你如何在 Jakefile 中编译 CoffeeScript?

标签 javascript node.js coffeescript jake

我想创建一个 Jakefile 来编译一些 CoffeeScript 来安装 NodeJS 应用程序。

你是怎么做到的?

我试过: 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')))

..当然,假设您安装了 coffee-script Node 模块。

翻译自此Cakefile我的。

关于javascript - 你如何在 Jakefile 中编译 CoffeeScript?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7552269/

相关文章:

javascript - 如何在以下 Jest 测试中获取 window/global?

javascript - 原生 javascript JSON.parse 抛出 typeError

node.js - Firebase...使用 node.js 脚本添加/更新 Firebase

angularjs - 如何绑定(bind)指令范围的深层子属性?

javascript - 单击提交按钮时无法从下拉列表中获取所选值

javascript - 从选择中删除和恢复选项

node.js - 如何在 node.js 中重用可读流?

node.js - 删除 azure blob block 列表express/nodejs

node.js - console.log 在 puppeteer 评估函数中不起作用

javascript - Rails - 为一个 Controller 生成两个 javascript 文件,因此 js 函数执行两次