Created
November 12, 2014 22:47
-
-
Save Rendez/4ffc1b37bdd5b2ea36ce to your computer and use it in GitHub Desktop.
padrino and sinatra-assetpack rake task assets:precompile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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