从 CoffeeScript 节点应用程序生成的 cake js 文件应该去哪里?
我在编写 Node JS 应用程序时使用 CoffeeScript,并使用 Cake Watch 实时编译我的 JS 文件。
能够做到这一点真是太好了——但是我应该把这些 js 文件放在哪里呢?现在,我将它们保存在各自的咖啡脚本文件旁边,但这感觉很尴尬......
I'm using coffeescript while writing a node js app and use cake watch to compile my js files real time.
That's great to be able to do that - but where should I stick those js files? Right now, I'm saving them right next to their respective coffeescript files, but that just feels awkward...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我已经习惯的惯例是将 CoffeeScript 文件放在
src
目录中,并将“编译”的 JavaScript 输出保存到lib
目录中。像这样:package.json
lib/mymodule.js
src/mymodule.coffee
如果将模块发布到 npm 注册表,则只需包含生成的
lib
目录,该目录通常是用 JavaScript 编写的项目保存的位置.js
文件。这使一切保持一致。The convention I've gotten comfortable with is to put CoffeeScript files in a
src
directory and have "compiled" JavaScript output to alib
directory. Like so:package.json
lib/mymodule.js
src/mymodule.coffee
If you publish the module to the npm registry, you can just include the resulting
lib
directory, which is conventionally where projects written in JavaScript keep there.js
files. This keeps everything consistent.