最新版本的jquery-tmpl-rails
会触发链轮弃用警告:
DEPRECATION WARNING: Sprockets method `register_engine` is deprecated.
Please register a mime type using `register_mime_type` then
use `register_compressor` or `register_transformer`.
https://github.com/rails/sprockets/blob/master/guides/extending_sprockets.md#supporting-all-versions-of-sprockets-in-processors
(called from block (2 levels) in <class:Railtie> at /my/path/to/gems/jquery-tmpl-rails-ef6f58001d41/lib/jquery-tmpl-rails/engine.rb:10)
在弃用警告之后,gem中的问题只是驻留在此处:https://github.com/jimmycuadra/jquery-tmpl-rails/blob/master/lib/jquery-tmpl-rails/engine.rb#L10
目前正在:
app.assets.register_engine(".tmpl", JqueryTemplate)
然后,我访问了链轮指南,以处理折页,可扩展性和符合链轮2,3,4。 https://github.com/rails/sprockets/blob/master/guides/extending_sprockets.md#supporting-all-versions-of-sprockets-in-processors
我尽力在这个问题上解决这个问题:https://github.com/oceanshq/jquery-tmpl-rails/commit/de7a59894f512efb3c1eba432da3517f21d921a2
这是:
asset.register_mime_type 'application/javascript', extensions: ['.tmpl'], charset: :unicode
asset.register_preprocessor 'application/javascript', JqueryTemplate
但是,此尝试只是在尝试运行Web应用程序或在CI上进行测试时处理破坏。显然,我错过了一些东西。
register_engine
,但实际上是否可以在停留在Sprockets 3中时从register_engine
迁移?