Skip to content
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

import not found when @import bootstrap in application.css.scss #66

Closed
lanvige opened this issue Feb 16, 2012 · 15 comments
Closed

import not found when @import bootstrap in application.css.scss #66

lanvige opened this issue Feb 16, 2012 · 15 comments

Comments

@lanvige
Copy link

lanvige commented Feb 16, 2012

firstly, i changed the application.css to .css.scss
then add @import "bootstrap"; line.

but the page show an error:

File to import not found or unreadable: bootstrap.

but i works when i change the import line to another .scss file and require it in application.css.scss.

and another question is the file which import bootstrap can't end with .css.scss but only .scss. i don't know what's the different between the two type files?

@jamesarosen
Copy link

I get the same error regardless of where I have the @import statement. I've also tried everything in #69 to no avail.

Things that don't work:

  • @import "bootstrap" in vendor.scss
  • @import "bootstrap" in vendor.css.scss
  • @import "bootstrap.scss" in vendor.css.scss
  • @import "bootstrap" in twitter-bootstrap.scss with @import "twitter-bootstrap" in vendor.css.scss
  • countless other similar variations

@jamesarosen
Copy link

Whoops. My problem was that I had bootstrap-sass as a gem dependency of another engine. Rails apparently doesn't look "through" one engine to another when autoloading. Adding require "bootstrap-sass" to my own engine fixed the problem.

@cdredfox
Copy link

in cloudfoundry.org deploy still this issue

@volkanunsal
Copy link

I solved this by putting an underscore in front of the filename, i.e.

@import "_bootstrap";

@timuckun
Copy link

timuckun commented Oct 8, 2012

import "bootstrap";

I am running into the same problem and using the underscore doesn't help either.

Sass::SyntaxError: File to import not found or unreadable: bootstrap.
Load path: Sass::Rails::Importer(/Users/tim/Documents/digital_dialogue/source/chrysler/app/assets/stylesheets/bootstrap_and_overrides.css.scss)
(in /Users/tim/Documents/digital_dialogue/source/chrysler/app/assets/stylesheets/bootstrap_and_overrides.css.scss)

@alenteria
Copy link

same problem here

Is this problem still not solved?

@Chucheen
Copy link

Chucheen commented Nov 4, 2013

I have the same problem. I'm using rails 3.2.15.
But, it's not only with bootstrap, it happens also for any file with extension scss. If i change extension to css it solves the file right away, but obviously doesn't convert to css.

Thanks in advance

@glebm
Copy link
Member

glebm commented Nov 4, 2013

you can try running "bundle update --source sass-rails"

@Chucheen
Copy link

Chucheen commented Nov 4, 2013

thanks @glebm but it didn't work. I't started to happen when i change the rails version from 3.2.3 to 3.2.15 because Bootstrap-dropdown didn't work. After having changed it, it worked again, but trying to push to Heroku throws error: "File to import not found or unreadable: custom.scss". The same error is thrown if i run "bundle exec rake assets:precompile".
Is there some config that changed from version 3.2.3 that i'm missing somewhere?

@glebm
Copy link
Member

glebm commented Nov 4, 2013

Looks like you are @import'ing custom somewhere in your code. The file doesn't exist.

@Chucheen
Copy link

Chucheen commented Nov 4, 2013

of course im importing it in my application.css file.

I've have posted a more detailed explanation of my problem here: http://stackoverflow.com/questions/19775301/file-to-import-not-found-or-unreadable-only-with-scss-files

check it out and i'd be very grateful if you point on which way to go or how can i solve it...

Thanks

@glebm
Copy link
Member

glebm commented Nov 4, 2013

Rename application.css to application.scss

@glebm
Copy link
Member

glebm commented Nov 4, 2013

Remove .scss from @import (extensions are picked up automatically)

@Chucheen
Copy link

Chucheen commented Nov 4, 2013

Thank you very much @glebm !!!

I renamed the file to .scss and it worked like a charm. Why is this? in version 3.2.3 it worked with css extension.

I have another doubt, not critical, do you know why after a rake assets:precompile the folder in public/assets doesn't include bootstrap folder and it did before? If i run rails s dropdown isn't working, but if i push to heroku it does there.
If i remove that folder, dropdown works again in development evironment.

maybe is some configuration missing in development environment for precompiling?

Thanks again for the above solution.

@glebm
Copy link
Member

glebm commented Nov 4, 2013

It's because a .css file is not processed by Sass, so @import will not work, see also: http://sass-lang.com/documentation/file.SASS_REFERENCE.html#import.

You should not be precompiling assets in development environment, nor checking in precompiled assets into source control. http://guides.rubyonrails.org/asset_pipeline.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants