Skip to content
Create a gist now

Instantly share code, notes, and snippets.

Embed URL


Subversion checkout URL

You can clone with
Download ZIP
Handlebars Rake::Pipeline filter
require "json"
class HandlebarsFilter < Rake::Pipeline::Filter
def initialize(&block)
block ||= proc { |input| input.sub(/\.handlebars$/, '.js') }
def generate_output(inputs, output)
inputs.each do |input|
output.write "return Ember.Handlebars.compile(#{})"

why don't create a file which appends:

output.write "Ember.TEMPLATES[filenamewithout_handlebars_extension] =  Ember.Handlebars.compile(#{})"

On this way, set up the view looks like better.

        templateName: 'filenamewithout_handlebars_extension'

What i don't really understand is the purpose of minispade????, could you give me a explanation?,

i know i have been using minispade for testing with bpm, but now i don't really get the point if minispade is required or not.

Last day, i could not mount my project with rakepipeline, and so far the hosting was node backend, i deployed my project without rakepipeline and emulate the pipeline behaviour with node tools.

That is the reason, why i am interesting to know which is the purpose of minispade, perhaps i am missing something i don't still know.


Minispade just lets you require your javascript in a different order than the order of your js files. If you use minispade you can concatenate all your javascript without worrying about what order the files get included, then use minispade to load what you need when you need it. If you have another way you're comfortable with managing the load order of your javascript, feel free to do that. You don't have to use minispade. You could definitely change the filter to add your templates to Ember.TEMPLATES if you wanted to. I prefer not to, since that means I have to make sure that whatever file that code gets written to gets loaded before the code that uses the template. With minispade, I don't have to worry about what files get loaded first, I just require a module when I need it.


@dudleyf With this method how is a template assigned to a View?


Given a template in lib/templates/myview.handlebars:

MyView = Ember.View.extend({
  template: minispade.require('lib/templates/myview.js')

That's not necessarily the right way to do it, it's just the way I did it :) We'll hopefully have a HandlebarsFilter in rake-pipeline-web-filters fairly soon that will do it the right way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.