0

I overhauled my CSS and may have removed some of my foundation files.

I get an error whenever I to compile anything with @import foundation in it: "File to import not found or unreadable: foundation." However, require foundation seems to work and foundation.css is served no problem.

Even if I add require foundation_and_overrides to application.scss, Rails complains about the @import foundation at the end of the required file.

Concatenation via require alone would be fine if I only wanted to use Foundation's classes/base rules, but I need to use its mixins and variables too, for which I need @import to work.

I tried running compass install foundation in my assets directory, but even after massaging the files that gives me, I'm left with the same "File to import not found or unreadable: foundation" error (this time in the generated app.scss).

How can I get @import foundation to work?

I'm on Rails 3.2.13.

From my Gemfile:

gem 'sass-rails'      # version 3.2.9
gem 'compass'         # version 0.12.2
gem 'zurb-foundation' # version 4.2.1

EDIT

According to the stack trace, lib/sass/tree/import_node.rb:45 is throwing a SyntaxError. That line looks like:

paths = @options[:load_paths]

which reinforces my suspicion that this is a paths issue, and the sass gem simply can't talk to the foundation gem. I'm not really sure how to investigate further. Help, please and thank you!

acobster
  • 1,637
  • 4
  • 17
  • 32
  • _Seemingly_ related SO questions [here](http://stackoverflow.com/questions/6005361/sass-import-error-in-rails-3-app-file-to-import-not-found-or-unreadable-comp) and [here](http://stackoverflow.com/questions/13630456/sass-import-directive-when-used-in-rails-engine-cant-find-assets-in-plugins) for anyone who's interested. :) – acobster Sep 27 '13 at 03:39

2 Answers2

0

For getting back the foundation files, trying

rails g foundation:install 

should add foundation_and_overrides.scss back to your asset pipeline

or if you don't want to use the generator

/*= require foundation */

in app/assets/stylesheet/application.css

and

@import "foundation_and_overrides";

to app/assets/stylesheets/amn.scss

For the second part of your question, correct me if I'm wrong but I believe the scss files are being loaded from the foundation gem

strivedi183
  • 4,749
  • 2
  • 31
  • 38
  • Thanks for clarifying about the foundation gem. My main problem remains, I've edited to clarify. – acobster Sep 25 '13 at 19:45
  • Have you tried adding 'gem install compass-rails' to your Gemfile, looking at the Foundation documentation (http://foundation.zurb.com/docs/rails.html) and it has a comment next to compass-rails "# you need this or you get an err" – strivedi183 Sep 26 '13 at 05:19
0

Well, it seems I can get what I want by using the "watch" method. For that to work, I had to create config/compass.rb. Here's what I put in it:

require 'zurb-foundation'

http_path = "/"
sass_dir = 'app/assets/stylesheets'
css_dir = 'app/assets/stylesheets'
images_dir = 'app/assets/images'
javascript_dir = 'app/assets/javascripts'

Then, from my application root, I ran compass watch.

acobster
  • 1,637
  • 4
  • 17
  • 32