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

Why do you have to redeclare the whole SASS Map? #23542

Closed
ghost opened this issue Aug 18, 2017 · 8 comments
Closed

Why do you have to redeclare the whole SASS Map? #23542

ghost opened this issue Aug 18, 2017 · 8 comments
Labels

Comments

@ghost
Copy link

ghost commented Aug 18, 2017

Why do you have to redeclare the whole SASS Map when you re-map the variables?

I can't complete a build if I do this partially, I have to redeclare everything to make it work :(

@bardiharborow
Copy link
Member

I assume you're referring to the maps added in #23260. The whole point is that you shouldn't have to redeclare the whole map, so if that's what's happening to you, can you share your code and what sass version you're using, and we'll try and figure out what's going on.

@ghost
Copy link
Author

ghost commented Aug 18, 2017

Yeah so basically, for example I'd like orange to be the primary color

// Custom Variables
$theme-colors: (
  primary: $orange,
  secondary: $gray-600,
  success: $green,
  info: $cyan,
  warning: $yellow,
  danger: $red,
  light: $gray-100,
  dark: $gray-800
);

// Import all of bootstrap
@import 'bootstrap';

You get an error at compilation as the color variable names aren’t already defined. I am using Sass 3.4.23 (Selective Steve).

So I guess the question would be how do you add/amend/remove from the $theme-colors sass map?

@pat270
Copy link
Contributor

pat270 commented Aug 18, 2017

The color variable names aren't defined because Sass parses top down. The color variables are defined in the bootstrap import, either copy all the color variables above $theme-colors or just set:

$theme-colors: ( primary: #fd7e14 );

@mdo
Copy link
Member

mdo commented Aug 18, 2017

Demo I provided shows the map merging in action: https://codepen.io/emdeoh/pen/qXxYEO. Could be a Sass version issue?

@mdo
Copy link
Member

mdo commented Aug 20, 2017

Closing since this was resolved in our codebase.

@mdo mdo closed this as completed Aug 20, 2017
@ghost
Copy link
Author

ghost commented Aug 21, 2017

So you are basically saying just redefine your entire theme-colors stack… That is an unusual way to do it :(

@mdo
Copy link
Member

mdo commented Aug 21, 2017

No, I'm saying we fixed this issue since our beta in our v4-dev branch. Pull the latest and try that with your Sass compiler. If it doesn't work still, see if there's a difference in the Sass compilers and we can go from there.

@ghost
Copy link
Author

ghost commented Aug 21, 2017

Ah, I misunderstood, my apologise, I will try that now ;) Thank you for listening

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