Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use Foundation 5 with Compass+SASS?

The problem

Foundation 5 was released last week, that's great, but the new version requires to use bower for using F5 with SASS and the official documentation seems to be a bit incomplete and immature.

I'm trying to create a project using the steps proposed by the docs:

[sudo] npm install -g bower

and then

gem install foundation

No problems here. The problem is when creating a Compass project:

foundation new MY_PROJECT
cd MY_PROJECT
compass compile

After Compass compilation, I get the following error:

directory stylesheets/ 
    error scss/app.scss (Line 1: File to import not found or unreadable: settings.
Load paths:
  /home/cartucho/MY_PROJECT/scss
  /var/lib/gems/1.9.1/gems/compass-0.12.2/frameworks/blueprint/stylesheets
  /var/lib/gems/1.9.1/gems/compass-0.12.2/frameworks/compass/stylesheets
  /home/cartucho/MY_PROJECT/bower_components/foundation/scss
  Compass::SpriteImporter)
   create stylesheets/app.css 

Compass config file (config.rb):

# Require any additional compass plugins here.
add_import_path "bower_components/foundation/scss"

# Set this to the root of your project when deployed:
http_path = "/"
css_dir = "stylesheets"
sass_dir = "scss"
images_dir = "images"
javascripts_dir = "javascripts"

The SASS file (app.sass):

@import "settings";
@import "foundation";
...

The problem seems to be in config.rb:

add_import_path "bower_components/foundation/scss"

because Compass fail trying to import the files settings and foundation but I don't know how to fix it. Any help will be highly appreciated.

Thanks.

like image 218
Cartucho Avatar asked Nov 24 '13 19:11

Cartucho


People also ask

How do I set up Foundation 5 Sass?

Setting up Foundation 5 Sass is quick and easy! We recommend using the Command Line Interface. We've perfected the command line for quick and easy power, but you can use Foundation with just the files or other applications, like Mixture or CodeKit.

Can I use Foundation SASS on my Mac?

You can use it on your Mac to compile your SASS, start building templates, or for directing visual feedback. What's Next? Now that you have Foundation Sass installed, check out the awesome stuff you get and how to use it.

How do I compile a Sass project?

If you're using the CLI to create a project, the Sass compilation process is already set up for you. If not, you can compile our Sass files yourself, or drop in a pre-built CSS file. To get started, first install the framework files using favorite package manager like npm or yarn. Next, add the framework files as an import path.

How do I install and update my compass project with Bower?

Note: You can install bower by running the following command: We use bower to keep Foundation assets up to date within your project. Here's how you can update your project: First, you need create a file named bower.json in the root of your Compass project. This should contain the following: Next you will run bower update.


1 Answers

You need to change the line foundation new MY_PROJECT by replacing MY_PROJECT with the folder you want to install the project on. After that, confirm that these folders exist on the directory you specified above - "bower_components/foundation/scss"

When starting a project run compass init and then compass watch (in Terminal) to watch for changes on the .sass files.

Personally, I don't go that route and use http://koala-app.com/ to convert or "compile" my Sass. It's FREE and awesome.

like image 158
Mike Barwick Avatar answered Jan 05 '23 03:01

Mike Barwick