Skip to content
Create a gist now

Instantly share code, notes, and snippets.

require "json"
require "rake-pipeline-web-filters"
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(#{})"
# process all js, css and html files in app/assets
input "assets"
# processed files should be outputted to public
output "public"
# process all coffee files
# match "*.coffee" do
# compile all CoffeeScript files. the output file
# for the compilation should be the input name
# with the .coffee extension replaced with .js
# filter(CoffeeCompiler) do |input|
# input.sub(/\.coffee$/, '.js')
# end
match "*.js" do
filter Rake::Pipeline::Web::Filters::MinispadeFilter
match "*.handlebars" do
filter HandlebarsFilter
filter Rake::Pipeline::Web::Filters::MinispadeFilter
filter Rake::Pipeline::ConcatFilter, "templates.js"
end do
# specify filters for js files. this includes the
# output of the previous step, which converted
# coffee files to js files
match "*.js" do
# then, concatenate all JS files into a single file
filter Rake::Pipeline::ConcatFilter, "application.js"
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.