Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability to use slim in conjunction with ejs and jst in sprockets 4 #148

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/slim-rails/register_engine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ def self._register_engine(config)
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']#, charset: :html
env.register_mime_type 'application/javascript', extensions: ['.js.jst.ejs.slim']
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems to be very specific and tailored for your use case, but I think that if we're going add this, then let's do it in a more general form, how about:

env.register_mime_type 'application/javascript', extensions: %w[.js.slim .jst.slim .ejs.slim]

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Happy to do so. However I did realize that it is not working as intended. Will continue investigation and report back once solved.

env.register_transformer 'text/slim', 'text/html', RegisterEngine::Transformer
elsif env.respond_to?(:register_engine)
args = ['.slim', Slim::Template]
Expand Down