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

Override value from one json by value from another json #99

Open
Frimlik opened this issue Apr 14, 2021 · 0 comments
Open

Override value from one json by value from another json #99

Frimlik opened this issue Apr 14, 2021 · 0 comments

Comments

@Frimlik
Copy link

Frimlik commented Apr 14, 2021

Hi,
I'm mixing Angular project with bootstrap lib and would like to have in my Angular project two theme files, one with default values, another with custom values, like this:
theme-colors-default.json

{  
  "colors": {
    "primaryColor": "yellow",
    "secondaryColor": "blue"
  }
}

theme-colors-custom.json

{
  "colors": {
    "primaryColor": "green"
  }
}

Then I have a style file, where I import both themes with help of node-sass-json-importer.
_variables.scss

@import 'src/themes/theme-colors-default.json';
@import 'src/themes/theme-colors-custom.json';

$primary = $primary-color

Now, if I access map-get($colors, 'secondary-color'), I get default bootstrap color (I suppose because first json is overwritten by second totally and thus secondaryColor is missing). Is it somehow possible to arrange some kind of 'overriding', to override only values present in custom theme?

The only way I can see now is to copy the default theme and change only values that need to be changed, but I don't like this way very much.

Thanks.

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

1 participant