From 34cae5fec26813686023ee6271789bfaa3286923 Mon Sep 17 00:00:00 2001 From: Chris Gunther Date: Tue, 12 May 2020 14:39:18 -0400 Subject: [PATCH] Add text/ejs to register_transformer_suffix for ERBProcessor Processes .jst.ejs.erb files through ERBProcessor before continuing on with EjsProcessor and JstProcessor. A similar change was made in #491 to support .jst.eco.erb files. --- CHANGELOG.md | 1 + lib/sprockets.rb | 1 + test/test_transformers.rb | 1 + 3 files changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3ef859ab9..6eb27b533 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ Get upgrade notes from Sprockets 3.x to 4.x at https://github.com/rails/sprocket ## Master - Fix for Ruby 2.7 keyword arguments warning in `base.rb`. [#660](https://github.com/rails/sprockets/pull/660) +- Process `*.jst.ejs.erb` files with ERBProcessor [#674] ## 4.0.0 diff --git a/lib/sprockets.rb b/lib/sprockets.rb index 91e05bc51..1cf305e3c 100644 --- a/lib/sprockets.rb +++ b/lib/sprockets.rb @@ -189,6 +189,7 @@ module Sprockets text/scss text/yaml text/eco + text/ejs ), 'application/\2+ruby', '.erb', ERBProcessor) register_mime_type 'application/html+ruby', extensions: ['.html.erb', '.erb', '.rhtml'], charset: :html diff --git a/test/test_transformers.rb b/test/test_transformers.rb index e021325d6..65b3575b5 100644 --- a/test/test_transformers.rb +++ b/test/test_transformers.rb @@ -121,6 +121,7 @@ def setup ['application/javascript+ruby', 0.8], ['application/coffeescript+ruby', 0.8], ["application/eco+ruby", 0.8], + ["application/ejs+ruby", 0.8], ['text/mustache', 0.8], # TODO: Extra step transform should be weighted down ['text/x-handlebars-template', 0.8], # TODO: Extra step transform should be weighted down ['application/dart', 0.8]