You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
rubygem-slim/SOURCES/rubygem-slim-4.1.0-see-if-t...

44 lines
1.6 KiB

From 14a845a75047fd564acdc940c25f9bab599bbb9c Mon Sep 17 00:00:00 2001
From: stonean <andy@stonean.com>
Date: Sun, 27 May 2018 15:03:22 -0400
Subject: [PATCH] see if this fixes the unknown line indicator. worked for
slim-rails :)
---
test/rails/config/application.rb | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/test/rails/config/application.rb b/test/rails/config/application.rb
index bbbd15fc..7bd6d2f6 100644
--- a/test/rails/config/application.rb
+++ b/test/rails/config/application.rb
@@ -5,6 +5,7 @@
require 'action_view/railtie'
#require 'active_record/railtie'
#require 'action_mailer/railtie'
+require "sprockets/railtie"
require 'slim'
@@ -40,5 +41,20 @@ class Application < Rails::Application
# Configure sensitive parameters which will be filtered from the log file.
config.filter_parameters += [:password]
+
+ # From slim-rails fix for "ActionView::Template::Error: Unknown line indicator"
+ # https://github.com/slim-template/slim-rails/blob/991589ea5648e5e896781e68912bc51beaf4102a/lib/slim-rails/register_engine.rb
+ if config.respond_to?(:assets)
+ config.assets.configure do |env|
+ if env.respond_to?(:register_transformer) && Sprockets::VERSION.to_i > 3
+ env.register_mime_type 'text/slim', extensions: ['.slim', '.slim.html']
+ env.register_transformer 'text/slim', 'text/html', RegisterEngine::Transformer
+ elsif env.respond_to?(:register_engine)
+ args = ['.slim', Slim::Template]
+ args << { silence_deprecation: true } if Sprockets::VERSION.start_with?('3')
+ env.register_engine(*args)
+ end
+ end
+ end
end
end