mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
c690b7124d
This makes "sprockets/railtie" explicit. This means that sprockets will be loaded when you require "rails/all". If you are not using requiring "rails/all", you need to manually load it with all other framework railties. In order to be complete, this commit also adds --skip-sprockets to the rails generator.
26 lines
739 B
Ruby
26 lines
739 B
Ruby
namespace :assets do
|
|
desc "Compile all the assets named in config.assets.precompile"
|
|
task :precompile do
|
|
if ENV["RAILS_GROUPS"].to_s.empty?
|
|
ENV["RAILS_GROUPS"] = "assets"
|
|
Kernel.exec $0, *ARGV
|
|
else
|
|
Rake::Task["environment"].invoke
|
|
Sprockets::Helpers::RailsHelper
|
|
|
|
assets = Rails.application.config.assets.precompile
|
|
Rails.application.assets.precompile(*assets)
|
|
end
|
|
end
|
|
|
|
desc "Remove compiled assets"
|
|
task :clean => :environment do
|
|
assets = Rails.application.config.assets
|
|
public_asset_path = Rails.public_path + assets.prefix
|
|
file_list = FileList.new("#{public_asset_path}/**/*")
|
|
file_list.each do |file|
|
|
rm_rf file
|
|
rm_rf "#{file}.gz"
|
|
end
|
|
end
|
|
end
|