Class: SourceMapsFixer::Path
- Inherits:
-
Object
- Object
- SourceMapsFixer::Path
- Defined in:
- lib/source_maps_fixer.rb
Class Method Summary collapse
- .digest_path(file_name) ⇒ Object
- .files_with_source_maps ⇒ Object
- .source_mapping_url(file_name) ⇒ Object
Class Method Details
.digest_path(file_name) ⇒ Object
14 15 16 |
# File 'lib/source_maps_fixer.rb', line 14 def self.digest_path file_name Rails.application.assets.find_asset(file_name).digest_path end |
.files_with_source_maps ⇒ Object
7 8 9 10 11 12 |
# File 'lib/source_maps_fixer.rb', line 7 def self.files_with_source_maps Dir.glob("#{Rails.root.join 'app', 'assets'}/**/*") .find_all { |name| name =~ /\.map\Z/ } .map { |name| [name.sub('.map', ''), name] } .to_h end |
.source_mapping_url(file_name) ⇒ Object
18 19 20 21 22 23 24 25 |
# File 'lib/source_maps_fixer.rb', line 18 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 |