Module: SourceMapsFixer::FixCompiled
- Defined in:
- lib/source_maps_fixer.rb
Class Method Summary collapse
Class Method Details
.call ⇒ Object
56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/source_maps_fixer.rb', line 56 def call Path.files_with_source_maps('js').each do |asset_path, _sm_path| public_path = Dir.glob("#{Rails.root.join 'public', 'assets'}/**/*") .find do |path| File.basename(path) == Path.digest_path(asset_path) end lines = File.readlines(public_path) next unless lines[-2] == "//!\n" && lines[-1] == ";\n" File.write(public_path, lines[0..-3].join) end end |