Skip to content

Instantly share code, notes, and snippets.

@jondot
Created January 11, 2013 11:14
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save jondot/4509939 to your computer and use it in GitHub Desktop.
Save jondot/4509939 to your computer and use it in GitHub Desktop.
Assetfile
require 'rake-pipeline-web-filters'
output "public"
class Rake::Pipeline::DSL::PipelineDSL
def production?
ENV['RAKEP_MODE'] == 'production'
end
end
input "assets/javascripts" do
match "app/**/*.coffee" do
coffee_script
end
match "app/**/*.js" do
minispade :rewrite_requires => true, :module_id_generator => proc { |input|
input.path.sub(/^app\//, '').sub(/\.js$/, '')
}
uglify if production?
concat "application.js"
end
match "vendor/**/*.js" do
uglify if production?
concat %w[
vendor/jquery.js
vendor/handlebars.js
vendor/ember.js
], "application.js"
end
end
input "assets/stylesheets" do
match "**/*.sass" do
sass
end
match "**/*.css" do
yui_css if production?
concat "application.css"
end
end
# Finally, we keep our static assets that don't need any processing
# in a `static/` directory.
input "assets/static" do
match "**/*" do
# The block we pass to `concat` lets us adjust the output path
# of any files it matches. Here we take each input and strip
# off the `static/` prefix, so `app/static/index.html` ends up
# in `public/index.html`.
concat do |input|
input.sub(/static\//, '')
end
end
end
# vim:ft=ruby
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment