FIX: when CDN assets are not in root path source maps fail

This commit is contained in:
Sam
2016-02-05 13:05:47 +11:00
parent 0ef141b2c3
commit 886273f158
3 changed files with 41 additions and 2 deletions
+2 -2
View File
@@ -102,8 +102,8 @@ end
def compress_node(from,to)
to_path = "#{assets_path}/#{to}"
source_map_root = (d=File.dirname(from)) == "." ? "/assets" : "/assets/#{d}"
assets = cdn_relative_path("/assets")
source_map_root = assets + (d=File.dirname(from)) == "." ? "" : "/#{d}"
source_map_url = cdn_path "/assets/#{to}.map"
cmd = "uglifyjs '#{assets_path}/#{from}' -p relative -c -m -o '#{to_path}' --source-map-root '#{source_map_root}' --source-map '#{assets_path}/#{to}.map' --source-map-url '#{source_map_url}'"