Skip to content

Commit 500b895

Browse files
author
Tim Morgan
committed
Bugfix for incorrect sourcemap filenames
1 parent b583013 commit 500b895

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

lib/squash/javascript/patches.rb

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,12 @@
44
# @private
55
class Sprockets::Asset
66
def sourcemap
7+
resource_path = [Rails.application.config.assets.prefix, logical_path].join('/')
8+
79
if included
8-
return included.inject(SourceMap::Map.new) do |map, path|
10+
return included.inject(SourceMap::Map.new([], resource_path)) do |map, path|
911
asset = @environment.load(path)
10-
map + asset.sourcemap
12+
asset.sourcemap + map
1113
end
1214
end
1315

@@ -19,7 +21,6 @@ def sourcemap
1921
# any extensions after the ".js" can be removed, because they will have
2022
# already been processed
2123
relative_path.gsub! /(?<=\.js)\..*$/, ''
22-
resource_path = [Rails.application.config.assets.prefix, logical_path].join('/')
2324

2425
mappings = Array.new
2526
to_s.lines.each_with_index do |_, index|

lib/squash/javascript/tasks/sourcemaps.rake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ namespace :sourcemaps do
4545
'revision' => Squash::Ruby.current_revision,
4646
'sourcemap' => Base64.encode64(Zlib::Deflate.deflate(map.as_json.to_json)),
4747
'from' => 'concatenated',
48-
'to' => 'compiled',
48+
'to' => 'compiled'
4949
}
5050
end
5151
end

0 commit comments

Comments
 (0)