Coder Social home page Coder Social logo

badoet / node-handlebars-precompiler Goto Github PK

View Code? Open in Web Editor NEW

This project forked from nicjansma/node-handlebars-precompiler

1.0 2.0 0.0 76 KB

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

JavaScript 100.00%

node-handlebars-precompiler's Introduction

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

node-handlebars-precompiler's People

Contributors

jwietelmann avatar

Stargazers

badoet avatar

Watchers

badoet avatar James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.