Yeoman Generator CoffeeScript入口点

jur*_*jan 2 generator coffeescript yeoman

是否可以将'index.coffee'文件挂钩作为Yeoman生成器的入口点?

'generator-generator'生成器创建'index.js'文件.用'index.coffee'替换它可以隐藏Yeoman的生成器.

我查看了文档,但没有找到任何提及它.

https://github.com/yeoman/yeoman/wiki/Generators

我找到了一个非常古老的Yeoman分支,似乎已经有了这个计划:

https://github.com/mklabs/yeoman/wiki/generators

目前我已经设置了一个将我的CoffeeScript文件编译成JavaScript的观察器.

小智 7

您希望您的index.js文件包含以下内容:

require('coffee-script');
module.exports = require('./index.coffee');
Run Code Online (Sandbox Code Playgroud)

然后把你的实际生成器代码放入index.coffee.我在这里移植了生成器 - 生成器的示例https://gist.github.com/tuxracer/6332601

  • [从CoffeeScript 1.7开始](https://github.com/jashkenas/coffeescript/issues/3349#issuecomment-34015414)你需要`'('coffee-script/register')`来加载compliler (2认同)