diff options
author | Santiago Pastorino <santiago@wyeworks.com> | 2011-09-21 17:21:44 -0700 |
---|---|---|
committer | Santiago Pastorino <santiago@wyeworks.com> | 2011-09-21 17:21:44 -0700 |
commit | 676ddfcf714c78024f75e37714e8eda484c3fad2 (patch) | |
tree | 1a40160566fe490b391b0b64a6c4a2862def8349 /actionpack/lib/sprockets/assets.rake | |
parent | 007f56701102647088673d92b165c3d862fbba22 (diff) | |
parent | 857d20efdab98cf56b777e034e1f150187c5fe9a (diff) | |
download | rails-676ddfcf714c78024f75e37714e8eda484c3fad2.tar.gz rails-676ddfcf714c78024f75e37714e8eda484c3fad2.tar.bz2 rails-676ddfcf714c78024f75e37714e8eda484c3fad2.zip |
Merge pull request #3081 from guilleiguaran/move-precompile-to-class
Move precompiling from task to Sprockets::StaticCompiler
Diffstat (limited to 'actionpack/lib/sprockets/assets.rake')
-rw-r--r-- | actionpack/lib/sprockets/assets.rake | 24 |
1 files changed, 2 insertions, 22 deletions
diff --git a/actionpack/lib/sprockets/assets.rake b/actionpack/lib/sprockets/assets.rake index 81223b7ead..e38ac6b489 100644 --- a/actionpack/lib/sprockets/assets.rake +++ b/actionpack/lib/sprockets/assets.rake @@ -20,30 +20,10 @@ namespace :assets do config = Rails.application.config env = Rails.application.assets target = Pathname.new(File.join(Rails.public_path, config.assets.prefix)) - manifest = {} manifest_path = config.assets.manifest || target - config.assets.precompile.each do |path| - env.each_logical_path do |logical_path| - if path.is_a?(Regexp) - next unless path.match(logical_path) - elsif path.is_a?(Proc) - next unless path.call(logical_path) - else - next unless File.fnmatch(path.to_s, logical_path) - end - - if asset = env.find_asset(logical_path) - asset_path = config.assets.digest ? asset.digest_path : logical_path - manifest[logical_path] = asset_path - filename = target.join(asset_path) - - mkdir_p filename.dirname - asset.write_to(filename) - asset.write_to("#{filename}.gz") if filename.to_s =~ /\.(css|js)$/ - end - end - end + static_compiler = Sprockets::StaticCompiler.new(env, target, :digest => config.assets.digest) + manifest = static_compiler.precompile(config.assets.precompile) File.open("#{manifest_path}/manifest.yml", 'wb') do |f| YAML.dump(manifest, f) |