Make less-rails work with sprockets 3
waynehoover opened this issue · comments
less-rails doesn't work with the latest sprockets 3 beta. I have created a simple rails 4.2 app to demonstrate: https://github.com/waynehoover/semantic-less-sprockets-3
Simply run bundle
then rails s
and go to the root url to see the error. I stumbled upon this while trying to integrate less-rails-semantic_ui into my app with the latest sprockets 3 beta (Semantic-Org/Semantic-UI-Rails-LESS#2). Not sure if its sprockets related or less-rails related, but sass-rails seems to work fine with sprockets-3.
Here is backtrace. Seems like Tilt interface will be deprecated in Sprockets 3.x and removed in 4.x.
So, I think need to support new processor interface.
@maxd The backtrace isn't visible to me.
I just ran into this issue myself. Upgrading only sprockets to 3.0 breaks my app whenever I try to do an asset_path
for a .less
file.
I did a lot of searching before finding this issue, so for search engines: The issue I ran into was an error of "undefined method `[]' for nil:NilClass" when upgrading to sprockets 3.
Same problem here ... finding this after 3h....
Might be time to escalate this issue as sprockets 3 was just released a lot of people will be upgrading.
+1 been debugging this for awhile. Sprockets 2.x requires tilt but sprockets 3.x does not. Less-rails requires tilt here, yet is not required in the gemfile. It was by luck that less-rails worked previously.
I am using the following as a fix:
# Gemfile
source 'https://rubygems.org'
gem 'rails', '4.1.1'
gem 'less-rails', '2.6.0'
# Require tilt supported with sprockets 2.x which is what less-rails was using.
gem 'tilt', '1.4.1'
+1 I just created a new rails 4.2 app, less-rails doesn't work
<%= stylesheet_link_tag 'application', media: 'all' %>
Throws:
undefined method `[]' for nil:NilClass
@cha55son I tried this out and found that adding tilt to my Gemfile did not fix the problem. I still get the same issue.
To clarify my error was something like:
File not found -- tilt
and was being generated from
Line 8 in c9f2cb9
+1, ended up locking sprockets to an older version after searching for several hours for a fix.
Getting the same error as @sporto.
The same for me, still working with older version of Sprockets.
I have fix prepared in sprockets3
branch. Can you please confirm it works for you? I'm going to release new version ASAP.
I can confirm that this new branch fixes the issue for me.
New version is out (https://rubygems.org/gems/less-rails/versions/2.7.0). Yay!
👍 Excelent!
Indeed, well done!