diff --git a/lib/tasks/assets.rake b/lib/tasks/assets.rake index 585244a49f6..4f11680f548 100644 --- a/lib/tasks/assets.rake +++ b/lib/tasks/assets.rake @@ -36,11 +36,6 @@ task 'assets:precompile:before' do require 'sprockets' require 'digest/sha1' - - # Needed for proper source maps with a CDN - load "#{Rails.root}/lib/global_path.rb" - include GlobalPath - end task 'assets:precompile:css' => 'environment' do @@ -80,6 +75,20 @@ def assets_path "#{Rails.root}/public/assets" end +def global_path_klass + @global_path_klass ||= Class.new do + extend GlobalPath + end +end + +def cdn_path(p) + global_path_klass.cdn_relative_path(p) +end + +def cdn_relative_path(p) + global_path_klass.cdn_relative_path(p) +end + def compress_node(from, to) to_path = "#{assets_path}/#{to}" assets = cdn_relative_path("/assets")