在Windows中预编译Handlebars.js模板

Chr*_*row 15 javascript templates pre-compilation node.js handlebars.js

查看Handlebars.js文档以进行预编译.

说明适用于OSX.这可以在Windows上完成吗?

如果是这样,当他们说"安装节点和npm"时,"node"是指" node.js "吗?

s.e*_*ich 16

  1. 从这里安装适用于Windows的Node.js:http://nodejs.org/download/.
  2. 在命令提示符下运行:

    npm install handlebars -g
    
    Run Code Online (Sandbox Code Playgroud)

现在,您可以在命令提示符中使用以下语法:

handlebars <input> -f <output>
Run Code Online (Sandbox Code Playgroud)

,其中<input>是原始模板文件名,并且<output>是预先编译的模板文件名.

例:

把手person.hbr -f person.js