Module: SourceMapsFixer::Path
- Defined in:
- lib/source_maps_fixer.rb
Class Method Summary collapse
- .digest_path(file_name) ⇒ Object
- .files_with_source_maps(filter = '') ⇒ Object
- .source_mapping_url(file_name) ⇒ Object
Class Method Details
.digest_path(file_name) ⇒ Object
15 16 17 |
# File 'lib/source_maps_fixer.rb', line 15 def digest_path(file_name) Rails.application.assets.find_asset(file_name).digest_path end |
.files_with_source_maps(filter = '') ⇒ Object
9 10 11 12 13 |
# File 'lib/source_maps_fixer.rb', line 9 def files_with_source_maps(filter = '') Dir.glob("#{Rails.root.join 'app', 'assets'}/**/*") .grep(/#{filter}\.map\Z/) .to_h { |name| [name.sub('.map', ''), name] } end |
.source_mapping_url(file_name) ⇒ Object
19 20 21 22 23 24 25 26 |
# File 'lib/source_maps_fixer.rb', line 19 def self.source_mapping_url(file_name) case file_name.match?(/\.css/) ? :css : :js when :css %(/*# sourceMappingURL=#{file_name}*/) when :js %(//# sourceMappingURL=#{file_name}) end end |