Skip to content

Instantly share code, notes, and snippets.

@Rendez
Created November 12, 2014 22:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Rendez/4ffc1b37bdd5b2ea36ce to your computer and use it in GitHub Desktop.
Save Rendez/4ffc1b37bdd5b2ea36ce to your computer and use it in GitHub Desktop.
padrino and sinatra-assetpack rake task assets:precompile
namespace :assets do
def load_apps
require File.expand_path('config/boot.rb', Rake.application.original_dir)
Padrino.mounted_apps
end
desc "Precompile all assets"
task :precompile => 'precompile:build'
namespace :precompile do
desc "Build assets"
task :build do
load_apps.each do |mounted_app|
if mounted_app.app_obj.respond_to?(:assets) && mounted_app.app_obj.assets.respond_to?(:build!)
mounted_app.app_obj.assets.build! do |file|
puts "+ #{file.gsub(Dir.pwd, '')}"
end
end
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment