Skip to content

Share your Handlebars templates between Node and the browser with minimal effort.

Notifications You must be signed in to change notification settings

badoet/node-handlebars-precompiler

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Hurray! I dont know what im celebrating from

This fork basically provide precompilation of handlebars templates for Ember.js application, basically the single process flow that took me many hours to be satisfied with.

hmm.. im new to the npm modules and stuff. so, to add this into ur project, u can install it manually. aka put the file inside the node_modules dir

This is how you might use it in an Express project:

app.configure('development', function(){
  hbsPrecompiler = require('handlebars-precompiler');
  hbsPrecompiler.watchDir(
    __dirname + "/views",
    __dirname + "/public/javascripts/templates.js",     // the single minified precompiled js - put above ur main ember js
    __dirname + "/public/javascripts/vendor/ember.js",  // ur ember.js file
  );
});

In this example, we watch for changes to *.handlebars files in our views directory. When changes are made, precompilation is run on all Handlebars templates and exported to a single minified Javascript file.

Client-side versions of the templates will be named and stored in the Ember.TEMPLATES object according to their file name, e.g. Ember.TEMPLATES['user_info'] more e.g. var view = Em.View.create({ name: "Bob", template: Em.TEMPLATES["user_info"] });

many thanks to: https://gist.github.com/2013669 and https://github.com/jwietelmann/node-handlebars-precompiler for code examples

About

Share your Handlebars templates between Node and the browser with minimal effort.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%