Field Notes

SASS file import error

January 15, 2015 | In 30 days

I'm sharing so that you might save the two days it took to resolve this issue.

I got this error when rendering a SASS file:

File to import not found or unreadable: bootstrap-sass-official/assets/stylesheets/bootstrap-sprockets

To my mystification, coworkers were able to compile it fine. It may because they use rbenv to manage their Ruby dependencies, and perhaps it has a different search path.

I was able to make it run temporarily by specifying an absolute file path. That's not a solution you can commit to source control.

The error looks like it's about a missing file, but no. The root problem was import order. Sprockets uses mixin code and was unable to run. Mixins was imported later in my original file.

Import bootstrap mixins FIRST in your sass file, like so:

/* bootstrap core */

@import "bootstrap-sass-official/assets/stylesheets/bootstrap/mixins";

@import "bootstrap-sass-official/assets/stylesheets/bootstrap-sprockets";

Happy coding!