我可以在coffeescript中写npm包吗? [英] Can I write npm package in coffeescript?
本文介绍了我可以在coffeescript中写npm包吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用coffeescript一段时间。现在我需要写一个npm包,我可以写在coffeescript,或者我应该编译coffeescript到javascript?
I have used coffeescript for a while. Now I need to write a npm package, can I write it in coffeescript, or I should compile coffeescript into javascript?
推荐答案
'我会建议你写你的包在coffeescript,但只发布它在javascript。我这样做:
I'm going to suggest that you write your package in coffeescript, but only publish it in javascript. I do it like this:
- coffeescript代码在
src
- 代码编译为
lib
-
src
承诺我的git仓库,lib
在我的.gitignore
-
lib
发布到npm,src
在我的.npmignore
-
咖啡脚本
包在我的devDependencies
- coffeescript code goes in
src
- code is compiled to
lib
src
is committed to my git repo,lib
is in my.gitignore
lib
is published to npm,src
is in my.npmignore
- the
coffee-script
package is in mydevDependencies
您可以查看我的一个简单包, refix ,以获得灵感:
You can take a look at a simple package of mine, refix, for inspiration:
- https ://github.com/linus/refix
-
npm install refix
- https://github.com/linus/refix
npm install refix
这篇关于我可以在coffeescript中写npm包吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文