Skip to content

Commit

Permalink
Support chaining of ERB for Sprockets 4 (#191)
Browse files Browse the repository at this point in the history
* fix CI failures due to usage of Rack 3
  • Loading branch information
ashkulz authored Jul 19, 2024
1 parent 2180fce commit 3a0043e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ source 'https://rubygems.org'

gemspec

gem "rack", "~> 2" # Rack 3 is not compatible with Jasmine and fails -- jasmine-3.99.0/lib/jasmine/server.rb:12:in `start': uninitialized constant Rack::Server (NameError)
gem "rails", "~> #{ENV['RAILS_VER'] || raise("missing rails version")}"
gem "sprockets", "~> #{ENV['SPROCKETS_VER'] || raise("missing sprockets version")}"

3 changes: 3 additions & 0 deletions lib/haml_coffee_assets/rails/engine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ class Engine < ::Rails::Engine
env.register_mime_type 'text/hamlc', extensions: ['.hamlc', '.jst.hamlc']
env.register_transformer 'text/hamlc', 'application/javascript', ::HamlCoffeeAssets::Transformer
env.register_transformer 'text/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
end

if env.respond_to?(:register_engine)
Expand Down

0 comments on commit 3a0043e

Please sign in to comment.