Precompiling Handlebars.js templates in Windows
Asked Answered
F

3

15

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 "install node and npm" does "node" refer to "node.js"?

Folsom answered 13/8, 2012 at 17:1 Comment(1)
Yes, "node" refers to "node.js". Should work fine on Windows but I don't have Windows so I can't say more than "should".Quadroon
R
16
  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

Rozanne answered 21/8, 2012 at 13:47 Comment(1)
it says handlebars its not recognized as an internal or external command.. i hate windows.Carlottacarlovingian
C
3

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

Crowl answered 17/8, 2012 at 7:22 Comment(0)
M
-2

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
Mucin answered 6/6, 2013 at 2:44 Comment(1)
Syntax highlighting does not != precompilingNeonatal

© 2022 - 2024 — McMap. All rights reserved.