Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

foreground() causes error in 6.3.0 gem upgrade #214

Closed
wrburgess opened this issue Dec 15, 2016 · 4 comments
Closed

foreground() causes error in 6.3.0 gem upgrade #214

wrburgess opened this issue Dec 15, 2016 · 4 comments

Comments

@wrburgess
Copy link

wrburgess commented Dec 15, 2016

Upgrading to 6.3.0.0 of this gem breaks due to changes in the Foundation 6.3.0 upgrade

How can we reproduce this bug?

  • Using Ruby 2.3.3
  • Using Rails 5.0.1
  • Upgrade to foundation-rails 6.3.0.0 in your Gemfile:
  • Run bundle update

Example:

# Gemfile

gem "foundation-rails", "6.3.0.0"

Run a process that requires a recompilation of scss files (in my case, a test with RSpec)

What did you expect to happen?

There should not be an error message

What happened instead?

     ActionView::Template::Error:
       $color: "foreground(#2199e8)" is not a color for `red'
     # ./app/assets/stylesheets/foundation_and_overrides.scss:30

Other information

I'm not sure what I'm supposed to do to accomodate these changes, but I think the problems point back to these changes:

foundation/foundation-sites#9319 (comment)

Temporary Fix

I commented out the // @include foundation-badge; and // @include foundation-label; lines in the foundation_and_overrides.scss file and things started working again

@Deckluhm
Copy link
Contributor

It's a breaking change listed in the 6.3 release notes:

The default color palette has changed to be meet AA contrast requirements. This has changed both defaults and a number scss variables and functions. Check out #9319 (comment)

Following the comment, you can see that the foreground() function has been replaced by a color-pick-contrast() function (which works slightly differently):

The foreground() function has been replaced with a new color-pick-contrast() function that uses luminosity instead of lightness.

All instances of the foreground() function have removed from _settings.scss in favor of setting explicit colors and alternate colors.

So I think you should just use color-pick-contrast() function, an explicit color or create your own function if it doesn't fit your needs.

@wrburgess
Copy link
Author

For anyone with this same issue, try these commands:

  • Note: back up any customizations made to _settings.scss
  • Note: better yet, create a new branch for this update, first!
  1. Change this line in your Gemfile:
gem "foundation-rails", "6.2.4.0"

to

gem "foundation-rails", "6.3.0.0"
  1. Command bundle install
  2. Command rails g foundation:install
  3. Reply n for all Overwrite permissions, except Y for overwriting app/assets/stylesheets/_settings.scss
  • Note: These steps will allow for the replacement of the foreground() function that breaks in foundation-rails 6.3.0.0

@Deckluhm
Copy link
Contributor

Note that this will overrides any customization previously made to _settings.scss (and that's probably not what most people wants).

Sadly there is no easy way to update the _settings.scss.

@ringe
Copy link

ringe commented Dec 22, 2016

Breaking changes always means side effects.
I solved this by removing _settings.scss and foundation_and_overrides.scss

Obviously not the preferred way to fix it. But I am in the middle of development, so the side effects are minimal for me.

andymeneely added a commit to VulnerabilityHistoryProject/vulnerability-history that referenced this issue Feb 17, 2017
Based on recommendation in foundation/foundation-rails#214

Fixes #160 because the warnings go away when we upgrade
airbr added a commit to airbr/freespot that referenced this issue Apr 19, 2017
…use this error. Temporary fix - likely to remove foundation if continues as issue
yakryder added a commit to yakryder/muscle-wizards that referenced this issue Apr 18, 2018
foundation/foundation-rails#214

Versioned up and did damage control in another branch but the site
didn’t look the same and unclear how much work it would have been to
get back to status quo. If this version will work for us it’s certainly
easier

Axed the aws.rb that we don’t seem to need any more with this batch of
deps
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants