Skip to content

Instantly share code, notes, and snippets.

Created December 12, 2011 15:53
Show Gist options
  • Save anonymous/1467984 to your computer and use it in GitHub Desktop.
Save anonymous/1467984 to your computer and use it in GitHub Desktop.
require "rake-pipeline-web-filters/minispade_filter"
require "rake-pipeline-web-filters/sass_compiler"
require "rake-pipeline-web-filters/ordering_concat_filter"
require "rake-pipeline-web-filters/helpers"
require "json"
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 SC.Handlebars.compile(#{input.read.to_json})"
end
end
end
input "assets"
output "public"
tmpdir ".rake-pipeline/tmp"
match "lib/**/*.handlebars" do
filter HandlebarsFilter
end
match "lib/vendor/*.js" do
concat %w[
vendor/minispade.js
vendor/jquery.js
vendor/sproutcore.js
], "js/vendor.js"
end
match "lib/**/*.js" do
minispade :module_id_generator => proc { |input| input.path.sub(/lib\//, 'bc/').sub(/\.js$/, '') }
concat "js/app.js"
end
match "scss/screen.scss" do
sass :cache_location => ".rake-pipeline/tmp/sass-cache", :additional_load_paths => "assets/scss"
concat do |input|
input.sub(/scss\//, "css/")
end
end
match "static/**/*" do
concat do |input|
input.sub(/^(bc|static)\//, '')
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment