Node.js with Handlebars.js on server and client

You should use pre-compiled client templates. They are faster executing and allow you to use the same template language on the server and client.

  1. Install handlebars globally npm install handlebars -g
  2. Precompile your templates handlebars client-template1.handlebars -f templates.js
  3. Include templates.js <script src="https://stackoverflow.com/questions/10037936/templates.js"></script>
  4. Execute the template var html = Handlebars.templates["client-template1"](context);

https://stackoverflow.com/a/13884587/8360

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)