Closed bsedin closed 8 years ago
Thanks! 0.6.1 released
Thanks!
The same deprecation warning is thrown here!
Moreover, instead of silencing the deprecation on Sprockets 3.7 onwards, its better to make it work for all versions of sprockets (2,3 and 4)!
Something like this should work for line 16:
if env.respond_to?(:register_transformer)
env.register_mime_type 'text/haml', extensions: ['.haml']
env.register_preprocessor 'text/haml', ::Tilt::HamlTemplate
end
if env.respond_to?(:register_engine)
args = ['.haml', ::Tilt::HamlTemplate]
args << { mime_type: 'text/haml', silence_deprecation: true } if Sprockets::VERSION.start_with?("3")
env.register_engine(*args)
end
You can wrap this up into a utility method, like this:
def register_engine_for_all_sprockets_version(extension, mime_type, preprocessor)
if env.respond_to?(:register_transformer)
env.register_mime_type mime_type, extensions: [ extension ]
env.register_preprocessor mime_type, preprocessor
end
if env.respond_to?(:register_engine)
args = [extension, preprocessor]
args << { mime_type: mime_type, silence_deprecation: true } if Sprockets::VERSION.start_with?("3")
env.register_engine(*args)
end
end
register_engine_for_all_sprockets_version(".haml", "text/haml", ::Tilt::HamlTemplate)
@nikhgupta https://github.com/bjarosze/riot_js-rails/pull/18 was merged
Fixes deprecation warning: