Giter Club home page Giter Club logo

gulp-ember-template-compiler's Introduction

gulp-ember-template-compiler

Precompile Handlebars templates for Ember.js.

Usage

First, install gulp-ember-template-compiler:

npm install gulp-ember-template-compiler --save-dev

Then, add this to your gulpfile.js:

var gulp = require('gulp');
var concat = require('gulp-concat');
var templateCompiler = require('gulp-ember-template-compiler');

gulp.task('templates', function () {
  gulp.src('/app/templates/*.hbs')
    .pipe(templateCompiler())
    .pipe(concat('templates.js'))
    .pipe(gulp.dest('/app/templates'));
});

Usage Tips

  • This plugin fit for Emberjs (>=)1.9.0 & Handlebars 2.0.0

gulp-ember-template-compiler's People

Contributors

acburdine avatar acsi avatar

Watchers

Louan T. C. Ko avatar

gulp-ember-template-compiler's Issues

is this working for 1.10.0?

is this working for 1.10.0?

I got this message:
Uncaught Error: Assertion Failed: template must be a function. Did you mean to call Ember.Handlebars.compile("...") or specify templateName instead?

Nested template names contain backslashes when compiled on Windows

When compiling templates on Windows, nested template names contain backslashes and it appears Ember can't resolve these. For example, a component template named nav-item might be found in hbs\components\nav-item.hbs on Windows. The plugin assigns this template to Ember.TEMPLATES['components\nav-item'] but it appears Ember expects Ember.TEMPLATES['components/nav-item'].

Could a fix for this be as simple as changing line 24 in index.js as follows?
file.contents = new Buffer("Ember.TEMPLATES['" + fileName.replace(/\\/g, '/') +"'] = Ember.Handlebars.template(" + compilerOutput + ");");

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.