Ruby unable to find Foundation/foundation-global?

三世轮回 提交于 2019-12-05 19:24:11

I was getting this same error, and it turned out that I just needed to restart my local development server.

This is a result of running rails g foundation:install with a different version of foundation than the one you have installed. foundation-global is no longer imported as part of foundation_and_overrides.scss.

Make sure you have the latest version and re-run rails g foundation:install. Just be careful when it offers to overwrite your application layout file - if you had modified that file. Keep the old file somewhere and merge the changes.

If you are using sass then have you renamed your application.css to applications.scss and have you imported the file @import "foundation"; and one more point if you are using the gem 'zurb-foundation', '~> 4.0.0' then you have to place it under assets like this

group :assets do
  gem 'sass-rails',   '~> 3.2.3'
  gem 'coffee-rails', '~> 3.2.1'
  gem 'uglifier', '>= 1.0.3'
  # Add Foundation Here
  gem 'zurb-foundation', '~> 4.0.0'
end

I also had this problem with Foundation + Bower + CodeKit.
I fixed it by replacing the following relative paths in app.scss:

BEFORE:
@import "_settings";
@import "foundation";

AFTER:
@import "_settings";
@import "../bower_components/foundation/scss/foundation";`    

And also replace this in settings.scss

BEFORE:
@import 'foundation/functions';

AFTER:
@import "../bower_components/foundation/scss/foundation/_functions";

Something is the matter with your zurb-foundation gem installation. There is supposed to be a file called _foundation_global.scss in the gem's directory which contains all the default global variables. You'll get this error if that file is missing.

Reinstalling the gem should fix you right up, in your app's directory run:

gem uninstall zurb-foundation
bundle install

If that fails, manually installing the Gem (gem install zurb-foundation) might work as well.

I experienced this problem today when updating zurb-foundation to version 4. It may be that your EC2 instance has a later version of Foundation installed. If so, I recommend updating your local development environment. My experience doing this might help ...

It seems that the @import 'foundation/foundation_global'; at the head of the foundation_and_overrides.scss, is no longer required. Instead, a single @import 'foundation'; at the foot of the same file is required.

Also, I had to change my application.js file to include only the lines (relevant to foundation);

//= require foundation

$(function(){ $(document).foundation(); });

I had tried to re-run the Foundation generator that is recommended here but it seems to assumes that it is working on a new project and simply appends the new JavaScript method, as opposed to replacing the previous.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!