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

Sass issue using color function #23690

Closed
craigpotter opened this issue Aug 26, 2017 · 3 comments
Closed

Sass issue using color function #23690

craigpotter opened this issue Aug 26, 2017 · 3 comments
Labels

Comments

@craigpotter
Copy link

When looking at Bootstrap Sass Options, it gives the example

// From the Sass map with our `color()` function
.beta { color: color("purple"); }

This doesn't work for me.
After debugging and putting lots of @debug statements in my own code and the BS4 _function.scss, I noticed that wrapping the color name in quotes stopped it working for me. It just returns null.

// From the Sass map with our `color()` function
.beta { color: color(purple); }

This version works for me.
Is any one else having this problem ?

  • Windows 10
  • Sass complied with Gulp-Sass
@MartijnCuppens
Copy link
Member

@craigpotter, which version of gulp-sass are you using?

@craigpotter
Copy link
Author

3.1.0

MartijnCuppens added a commit to MartijnCuppens/bootstrap that referenced this issue Aug 27, 2017
@MartijnCuppens
Copy link
Member

In _variables.scss colors are defined like this:

$colors: () !default;
$colors: map-merge((
  blue: $blue,
  indigo: $indigo,
  purple: $purple,
  pink: $pink,
  red: $red,
  orange: $orange,
  yellow: $yellow,
  green: $green,
  teal: $teal,
  cyan: $cyan,
  white: $white,
  gray: $gray-600,
  gray-dark: $gray-800
), $colors);

The problem here is that the type of the keys is color and not string because blue, purple,... are color names. So you must use color(purple) to get the value of purle.

But one key, gray-dark is not a a valid color name, so in that case you need to add the quotes.

Best option is to convert all keys to strings, so that you can always use the quoted notation.

MartijnCuppens added a commit to MartijnCuppens/bootstrap that referenced this issue Aug 28, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants