leshill / handlebars_assets

Use handlebars.js templates with the Rails asset pipeline.
MIT License
649 stars 159 forks source link

Fix sprockets version check #153

Open Borzik opened 8 years ago

Borzik commented 8 years ago

Based on this, we want HandlebarsTemplate to be used for rendering if Sprockets version is 3 or lower.

But in this file, we check if Sprockets version is less than 3, so all Sprockets versions higher than 3.0 will be affected, which causes a bug when asset helpers are not available.

Reduced test case is updated, you can test it now if you want (check Gemfile for versions).

timherby commented 7 years ago

Ran into this issue as well, and this solution worked for me. Would love to see this merged.

timherby commented 7 years ago

Unfortunately, after making that change, I'm seeing this deprecation warning:

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 in register_extensions at /Users/tim/.rvm/gems/ruby-2.1.2/bundler/gems/handlebars_assets-4e653d0bde94/lib/handlebars_assets.rb:22)

So it looks like it might not be that easy. We may need to do the original fix? https://github.com/leshill/handlebars_assets/pull/152