5

I've installed rvm and bourbon. I then installed bourbon into my /css directory. However when I try

@import 'bourbon/bourbon'; 

I get this error:

Sass::SyntaxError: File to import not found or unreadable: bourbon/bourbon.

I've checked out other threads with the same issue but none seemed to solve my problem. How can I get this error to go away and for bourbon to import correctly?

jamesmortensen
  • 33,636
  • 11
  • 99
  • 120
thomasp423
  • 357
  • 8
  • 20

5 Answers5

7

try this out:

In your Gemfile:

gem 'bourbon'

Then run:

bundle install

from github documentation of bouron

Non-Rails projects

Bourbon includes an easy way to generate a directory with all the necessary files. For command line help: $ bourbon help or visit the Command line tools wiki Install (Bourbon v3.0+)

gem install bourbon

Install Bourbon into the current directory by generating the bourbon folder:

bourbon install

The generated folder will contain all the mixins and other necessary Bourbon files. It is recommended not to add or modify the Bourbon files so that you can update Bourbon easily.

You can specify a target directory using the path flag:

bourbon install --path my/custom/path/

Import

Lastly, import the mixins at the beginning of your stylesheet(s):

@import 'bourbon/bourbon';

Note: Bourbon no longer requires a custom sass --watch command for Bourbon v3.0+
Sachin Singh
  • 7,107
  • 6
  • 40
  • 80
  • this what I got:$ gem 'bourbon' ERROR: While executing gem ... (Gem::CommandLineError) Unknown command bourbon $ bundle install Could not locate Gemfile – thomasp423 Apr 29 '14 at 16:24
  • oh!! are you not using rails, or bundler? – Sachin Singh Apr 29 '14 at 16:28
  • sorry for not giving enough info. I followed all of those steps. Bourbon Install and then install into my css folder. I got confirmation that it worked and there is bourbon folder in my css folder however it is not actually visible in finder but I do see it in terminal. – thomasp423 Apr 29 '14 at 16:36
  • @thomasp423 have you tried giving absolute path of 'bourbon.css.scss'? – Sachin Singh Apr 30 '14 at 04:53
0

It is important to note where the installation of bourbon is (assuming you're working on your local machine). When installing you can determine a custom install like this:

bourbon install --path my/custom/path/

It would be a good idea to place it in the directory that you usually save your local web files for easy access. I have mine installed in the user directory currently which is sort of pain, but I have to call in my bourbon like this in my sass files:

@import '/Users/myusername/rubygems/bourbon/_bourbon.scss';
erwstout
  • 1,277
  • 1
  • 13
  • 30
0

Yes this is actually late, just got into the same problem using Rails 4.2.5.1. I think in your own case, the problem being you didn't rename your asset pipeline (css file) to carry the extension .scss.

Here is how I fixed it :

How to get around it Bourbon for Ruby on Rails 4.2+

  1. Add Bourbon to your Gemfile:

    gem 'bourbon'

    Then run:

    bundle install

    Note: In your asset pipeline, if your stylesheet is still asset named application.css, you need to rename it to to application.scss.

    In my own case my pipeline is named application.css.scss and it worked because I have my extension still append to .scss extension.

  2. Delete all Sprockets directives in application.scss (require, require_tree and require_self) and use Sass’s native @import instead. The reason being as it is explained here. Such that your application.scss will Import Bourbon at the beginning like this below:

    Example:

      @import "bourbon";
      @import "bourbon";
      @import "bootstrap-sprockets";
      @import "bootstrap";
      @import "social-share-button";
    
  3. Then restart your server by running

    rails server

With all these, you should be up and running. For more info, see https://github.com/thoughtbot/bourbon

Afolabi Olaoluwa
  • 1,898
  • 3
  • 16
  • 37
0

I came across this issue when I upgraded versions of Rails (3.2 -> 5.0). During the process, I left behind group :assets in the Gemfile. Taking bourbon and other gems out of that group fixed the issue.

claptimes
  • 1,615
  • 15
  • 20
0

Try this (if you are using Rails):

  1. Open your Gemfile
  2. Make sure gem bourbon exists but is not in any groups
  3. Run bundle install

This happened to a colleague of mine when he upgraded versions of Rails (3.2 -> 5.0): he accidentally left some gems in the group :assets, which was deprecated in Rails 4.

Jack Compton
  • 323
  • 2
  • 5