jwhitley / requirejs-rails

RequireJS support for your Rails 3 or 4 application
MIT License
592 stars 202 forks source link

requirejs-rails isn't working with rails >= 5.1 because erubis has been replaced with erubi #276

Closed mdkalish closed 4 years ago

mdkalish commented 6 years ago

Rails 5.1 replaced erubis with erubi. requirejs-rails requires the erubis. The Rrequirejs::Rails::Builder#generate_rjs_driver would have to be rewritten to use Erubi instead of Erubis, to make requirejs-rails compatible with the rails >= 5.1. You guys plan to add the support for the new rails anytime soon? Or maybe you see any other way to keep using AMD in rails >= 5.1?

carsomyr commented 6 years ago

@mdkalish Is erubi backwards compatible?

mdkalish commented 6 years ago

I'm not sure if I follow your question, are you asking about backward compatibility throughout all versions? If yes, the answer is no; here are some breaking changes listed in the changelog: 1.5.0, 1.2.0, & 1.1.0.

Having said that, what's your plan? Erubi is a simplified fork of Erubis, do you think they could be easily swapped somehow? The erubi docs sound like it could pan out:

It is not designed with Erubis API compatibility in mind, though most Erubis ERB syntax works, with the following exceptions:

  • No support for <%=== for debug output
AdnanTheExcellent commented 6 years ago

I'm encountering this issue (Rake.application undefined) too when upgrading to rails 5.2. @mdkalish i'll apply your patch and see if that works. From what it sounds like, this still doesnt fix the entire issue, correct?

mdkalish commented 6 years ago

I had to add erubis to Gemfile and also fork requirejs-rails: https://github.com/lonelyplanet/requirejs-rails/commit/d742e7df37150448bbf40ef6fe814dba8aebd921. This solved the problem for me.