-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
File to import not found or unreadable: variables on Rails 3.2.16 #523
Comments
This should still resolve correctly. Can you post your Gemfile? Looks like you might be missing sass-rails or be locked to a very old version of one of the gems. |
I'm running Rails version 3.2.16 My Gemfile reads
and Gemfile.lock
Thanks for looking into this. |
The versions look fine, so something else must be wrong (other gems like sprockets-rails? config?). See @nex3's comment on |
I'm able to replicate the problem on a fresh installation of rails 3.2.16 with only bootstrap-sass as the additional gem. The problem appears when the @import is called in a file which is not placed in the root folder of stylesheets. e.g.
inside signup.css.scss, simply
and precompiling will result in the above error. Some additional setup application.rb
production.rb
|
Try setting it to true: config.assets.initialize_on_precompile = true |
Tried it, still getting the same error. |
Please push this to github |
ok, here's the link. |
Please do not use See https://github.com/glebm/ab/commit/482c141a8a0ae1c9fc95c1445095b0ecd9021149, and also rename the file to application.css.sass |
My bad for a typo in the production.rb. Fixed it, please take a look again. https://github.com/seantan/ab/commit/29034aa34550782c790baf4630c444afe156cf7c The problem occurs when bootstrap is imported from a file that is "non-root" level relative to assets/stylesheets. |
gem 'sprockets-rails', '=2.0.0.backport1'
gem 'sprockets', '= 2.2.2.backport2'
|
Nvm, doesn't work. Btw, unrelated but it's better to set precompile in |
At last, a workaround with backports of Rails 4 pipeline fixes: gem 'sprockets-rails', '~> 2.0.0.backport1'
gem 'sprockets', '~> 2.2.2.backport2'
gem 'sass-rails', github: 'guilleiguaran/sass-rails', branch: 'backport' As a bonus you get Rails 4 speed deployments . |
Thanks for working on this tirelessly! I'll try out the workaround soon. Btw, any reason why there was a Since bootstrap-sass has become the Official port of Bootstrap to Sass , 👍 IMO, it is important that the gem works out of the box without the workaround as it introduces uncertainties (backport gems and branch) which potential users might not accommodate. Thanks again @glebm for for the incredibly fast response in coming up with the workaround solution. 👍 |
I changed @import to use paths relative to the file in order to avoid relying on modified Sass load path, since the file directory is always present in @import path. This is mainly for non-ruby users (e.g. node-sass), as ruby users always get the load path on This does work out of the box in Rails 4, but, unfortunately, there is a bug in the older versions of the gems that has only been fixed in the backports. Meanwhile, I've added a note on this to Readme. |
Released 3.1.0.2 with the simpler fix above (does not require upgraded pipeline). gem 'bootstrap-sass', '~> 3.1.0.2' |
@glebm Tested the workaround and it works. Many thanks for the detailed explanation and releasing 3.1.0.2 which fixes the issue without requiring the workaround gems. 👍 |
Just want to update that 3.1.0.2 works for my Rails 3.2.16 App, even with gems still inside |
On advice of twbs/bootstrap-sass#523 (comment) This seems to let both compass and partials be found!!!!
FYI this works in Rails 3.2
|
Publisher deploys are failing because during assets precompilation, we're seeing an issue similar to: twbs/bootstrap-sass#523 This command fails during deploys: govuk_setenv publisher bundle exec rake \ RAILS_ENV=production RAILS_GROUPS=assets \ assets:precompile Rails 4 has removed the :assets group from the generated Gemfile. As mentioned in the above discussion, it seems OK for gems to move in that direction and to suggest removing :assets group: rails/rails@49c4af4 We have heavy weights like therubyracer in that group, which has been reported to be memory intensive. hence i'm avoiding removing :assets group entirely. For the current issue, it is sufficient to move sass-rails out of the :assets group to get assets to precompile.
After upgrading to version bootstrap-sass 3.1.0.1, I'm having the above error when precompiling assets.
My stylesheet contains.
After digging around a bit, i noticed the file
is different from the previous working version 3.0.3.0, in which the @import statements are missing "bootstrap/" path component.
version 3.0.3.0
version 3.1.0.1
Adding the missing path component allows me to precompile successfully.
The text was updated successfully, but these errors were encountered: