bootstrap-sass icon indicating copy to clipboard operation
bootstrap-sass copied to clipboard

Incorrect path for importing scss files

Open griff122 opened this issue 13 years ago • 2 comments

Hi,

I'm not sure if this is an issue, but I believe the reference path for @import of utilities is wrong when importing bootstrap.

My computer is a Windows 7 professional 64bit. I'm using Django 1.5 with Python2.7 to run a local server. And Sass 3.2.7 with ruby 2.0.0p0 [i368-mingw32], to build my css file from an app.scss file. This app.scss file contains the lines: @import "bootstrap" @import "bootstrap-responsive" @import "local" // custom local css relevant to current project //

When I build the css file using the command line: "sass app.scss:app.css --trace" errors are thrown saying that "bootstrap/variables"; could not be found.

The bootstrap.scss file located in "/vendor/assets/stylesheets" has this line: @import "bootstrap/bootstrap"; which makes sense because in the bootstrap subdirectory the bootstrap.scss file there will be imported. The issue seems to be with how this bootstrap.scss in the subdirectory is importing other utilities. example: @import "bootstrap/scaffolding";

When bootstrap/bootstrap.scss tries to import it's trying to import from a directory that doesn't exist.

The fix is easy enough, just by overwriting the bootstrap.scss in the stylesheets top level directory, with the bootstrap.scss in the subdirectory (Also the same thing applies when import bootstrap-responsive).

However, it may be that my environment is not setup correctly, because I figured this would raise a lot of red flags in the user base.

griff122 avatar Mar 28 '13 20:03 griff122

The SASS load path should be the root of your included path, this is why all imports are absolute from that point.

SASS actually does a lot of interesting "smart" things in an attempt to find the files you request to import.

If you're using Rails, we also add a Sass.load_paths entry when the gem is loaded, indicating a correct load path for our library.

In your sass command line, this would be sass --load-path=your/path/to/sass app.scss:app.css. This stabilizes the paths and lets sass know where to look for absolute paths. Let me know if that works.

If you're looking for a straight sass port to use without a framework, I recommend https://github.com/jlong/sass-twitter-bootstrap/ as a more pure port and one that would be easier to work with using bare sass. Our gem is designed to be a drop-in for Rails and Compass users mainly.

trisweb avatar Mar 28 '13 20:03 trisweb

Ah hah, that make's a lot more sense. Thank you for that clarification. First time Sass user here, and it appears I confused the setup instructions, where I downloaded this version, and was looking at documentation for the straight sass port. This explains why the directory names weren't even close.

facepalm

Sorry for opening a ticket where the issue was in the user and not the source.

griff122 avatar Mar 28 '13 21:03 griff122