Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
391 views
in Technique[技术] by (71.8m points)

node.js - Can I write npm package in CoffeeScript?

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?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

I'm going to suggest that you write your package in coffeescript, but only publish it in javascript. I do it like this:

  • 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 my devDependencies

You can take a look at a simple package of mine, refix, for inspiration:


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...