Skip to content

Commit

Permalink
[#189] Fix .hamlc is processed by jst unexpectedly (#192)
Browse files Browse the repository at this point in the history
  • Loading branch information
voducvu authored Jul 20, 2024
1 parent 31efae5 commit 3242b19
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/haml_coffee_assets/rails/engine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,11 @@ class Engine < ::Rails::Engine

config.assets.configure do |env|
if env.respond_to?(:register_transformer)
env.register_mime_type 'text/hamlc', extensions: ['.hamlc', '.jst.hamlc']
env.register_mime_type 'text/hamlc', extensions: ['.hamlc']
env.register_mime_type 'text/jst+hamlc', extensions: ['.jst.hamlc']
env.register_transformer 'text/hamlc', 'application/javascript', ::HamlCoffeeAssets::Transformer
env.register_transformer 'text/hamlc', 'application/javascript+function', ::HamlCoffeeAssets::Transformer
env.register_transformer 'text/jst+hamlc', 'application/javascript+function', ::HamlCoffeeAssets::Transformer

# support for chaining via ERB, documented via https://github.com/rails/sprockets/pull/807
env.register_mime_type 'text/hamlc+ruby', extensions: ['.hamlc.erb', '.jst.hamlc.erb']
env.register_transformer 'text/hamlc+ruby', 'text/hamlc', ::Sprockets::ERBProcessor
Expand Down

0 comments on commit 3242b19

Please sign in to comment.