0

我们如何在玉车把中编写文档级咖啡脚本?在玉文件中,我使用了以下

 template(name="hellow")
      :coffeescript
         alert('helloworld')

但它给出了错误。帮帮我,伙计们

错误

Error: Cannot find module 'coffee-script'
    at Function.Module._resolveFilename (module.js:338:15)
    at Function.Module._load (module.js:280:25)
    at Module.require (module.js:362:17)
    at require (module.js:378:17)
    at module.exports.coffeescript (/home/rohan/.meteorite/packages/jade-handlebars/jrhone/meteor-jade-handlebars/e442fecedeac64b81a0865e1b195a630181a3ee4/jade/lib/filters.js:93:14)
    at Object.Compiler.visitFilter (/home/rohan/.meteorite/packages/jade-handlebars/jrhone/meteor-jade-handlebars/e442fecedeac64b81a0865e1b195a630181a3ee4/jade/lib/compiler.js:419:28)
    at Object.Compiler.visitNode (/home/rohan/.meteorite/packages/jade-handlebars/jrhone/meteor-jade-handlebars/e442fecedeac64b81a0865e1b195a630181a3ee4/jade/lib/compiler.js:176:32)
    at Object.Compiler.visit (/home/rohan/.meteorite/packages/jade-handlebars/jrhone/meteor-jade-handlebars/e442fecedeac64b81a0865e1b195a630181a3ee4/jade/lib/compiler.js:161:10)
    at Object.Compiler.visitBlock (/home/rohan/.meteorite/packages/jade-handlebars/jrhone/meteor-jade-handlebars/e442fecedeac64b81a0865e1b195a630181a3ee4/jade/lib/compiler.js:253:12)
    at Object.Compiler.visitNode (/home/rohan/.meteorite/packages/jade-handlebars/jrhone/meteor-jade-handlebars/e442fecedeac64b81a0865e1b195a630181a3ee4/jade/lib/compiler.js:176:32)
    at Object.Compiler.visit (/home/rohan/.meteorite/packages/jade-handlebars/jrhone/meteor-jade-handlebars/e442fecedeac64b81a0865e1b195a630181a3ee4/jade/lib/compiler.js:161:10)
    at Object.Compiler.visitTag (/home/rohan/.meteorite/packages/jade-handlebars/jrhone/meteor-jade-handlebars/e442fecedeac64b81a0865e1b195a630181a3ee4/jade/lib/compiler.js:390:12)
    at Object.Compiler.visitNode (/home/rohan/.meteorite/packages/jade-handlebars/jrhone/meteor-jade-handlebars/e442fecedeac64b81a0865e1b195a630181a3ee4/jade/lib/compiler.js:176:32)
    at Object.Compiler.visit (/home/rohan/.meteorite/packages/jade-handlebars/jrhone/meteor-jade-handlebars/e442fecedeac64b81a0865e1b195a630181a3ee4/jade/lib/compiler.js:161:10)

先感谢您!!!!!

4

1 回答 1

1

即使您可以编译它,我也不确定它是否会做任何事情,因为meteor 动态地将元素注入主体的方式。例如,如果您添加:

script(type='text/javascript') alert('hello!')

到你的玉石或同等物:

<script type="text/javascript">alert('hello!')</script>

到您的 html,它实际上不会执行 - 至少它不适合我。我认为这是因为在脚本注入页面之前正文已经渲染。

除此之外,我确实得到了编译,但没有使用玉把手。在这里查看我的答案。

于 2013-08-05T16:14:32.197 回答