Precompiling Handlebars.js templates in Windows

前端 未结 3 1122
情深已故
情深已故 2021-02-02 15:37

Looking at the Handlebars.js documentation for precompilation.

The instructions are for OSX. Can this be done on Windows as well?

If so, when they say to \"insta

相关标签:
3条回答
  • 2021-02-02 15:56

    In visual studio you have 2 options:

    1) using a bundle transform from System.Web.Optimization

    2) using a postbuild event in visual studio (requires nodejs)

    see Gist

    0 讨论(0)
  • 2021-02-02 15:57
    1. Install Node.js for Windows from here: http://nodejs.org/download/.
    2. Run in the command prompt:

      npm install handlebars -g
      

    Now you can use the following syntax in the command prompt:

    handlebars <input> -f <output>
    

    ,where <input> is an original template file name, and <output> is a pre-compliled template file name.

    Example:

    handlebars person.hbr -f person.js

    0 讨论(0)
  • 2021-02-02 16:19

    It seems like ASP.NET Web Tools 2012.2 has built in handlebars support (from Scott Hanselman's blog):

    Syntax Highlighting for client side templating languages within the HTML editor like:

    • CoffeeScript
    • Mustache
    • Handlebars
    • JsRender
    0 讨论(0)
提交回复
热议问题