Giter Site home page Giter Site logo

andyhot / ember-template-compiler Goto Github PK

View Code? Open in Web Editor NEW

This project forked from toranb/ember-template-compiler

0.0 2.0 0.0 159 KB

An npm module for the ember-template-compiler.js file that ships with ember.js

License: MIT License

Ruby 18.81% JavaScript 81.19%

ember-template-compiler's Introduction

An npm module for the ember-template-compiler.js file that ships with ember.js

##What can I do with this?

If you have a client build process and need to compile handlebars templates for ember.js

npm install ember-template-compiler

var compiler = require('ember-template-compiler');
var template = fs.readFileSync('foo.handlebars').toString();
var input = compiler.precompile(template).toString();
var output = "Ember.TEMPLATES['foo'] = Ember.Handlebars.template(" + input + ");";

Additionally you can pass a second argument into precompile which will build the precompiled template as an object (true or undefined) or as a string (false). Building as a string is more efficient than building as an object then converting it to a string.

var input = compiler.precompile(template, false);
var output = "Ember.TEMPLATES['foo'] = Ember.Handlebars.template(" + input + ");";

##Handlebars Version

This package will utilize any recent Handlebars version. To require a specific version simply specify it in your package.json. By default the latest 1.x version will be used.

##Development

To run the tests you must have the following node packages installed: jasmine-node, and handlebars. Then run

npm test

License

Copyright © 2013 Toran Billups

Licensed under the MIT License

ember-template-compiler's People

Contributors

andyhot avatar johanneswuerbach avatar kingpin2k avatar rwjblue avatar toranb avatar

Watchers

 avatar  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.