public
Created

  • Download Gist
My assetfile
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
require "json"
require "rake-pipeline-web-filters"
class HandlebarsFilter < Rake::Pipeline::Filter
def initialize(&block)
block ||= proc { |input| input.sub(/\.handlebars$/, '.js') }
super(&block)
end
 
def generate_output(inputs, output)
inputs.each do |input|
output.write "return Ember.Handlebars.compile(#{input.read.to_json})"
end
end
end
 
# 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
# end
 
match "*.js" do
filter Rake::Pipeline::Web::Filters::MinispadeFilter
end
 
match "*.handlebars" do
filter HandlebarsFilter
filter Rake::Pipeline::Web::Filters::MinispadeFilter
filter Rake::Pipeline::ConcatFilter, "templates.js"
end
 
 
Rake::Pipeline.build 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"
end
 
end

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.