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

using json objects in SASS #92

Closed
v3nt opened this issue May 15, 2020 · 2 comments
Closed

using json objects in SASS #92

v3nt opened this issue May 15, 2020 · 2 comments

Comments

@v3nt
Copy link

v3nt commented May 15, 2020

Just wondering if there's an example of how this works with json objects as maps / array?

ie how do you call variable from this in the SASS files?

Thanks.

{
  "colors": {
    "primary": "#2c97de",
    "secondary": "#7F8FA4",
    "warning": "#f2c500",
    "success": "#1fce6d",
    "danger": "#e94b35",
    "error": "#e94b35"
  }
}

Tried this...

// json vars attempt
@import "../vars.json";
@debug map.get($colors, "primary");

error

% yarn build
yarn run v1.17.3
$ webpack --progress --config resources/assets/build/webpack.config.js
{
  colors: {
    primary: '#2c97de',
    secondary: '#7F8FA4',
    warning: '#f2c500',
    success: '#1fce6d',
    danger: '#e94b35',
    error: '#e94b35'
  }
}
Error: Failed because of a stylelint error.

 at /Users/danielcrabbe/Sites/foundlocations.co.uk/wp-content/themes/found-theme-sage-test/node_modules/stylelint-webpack-plugin/lib/run-compilation.js:39:14
error Command failed with exit code 1.

thanks, D.

@pmowrer
Copy link
Owner

pmowrer commented May 21, 2020

@v3nt Looks correct to me. Is it possible the error is occurring somewhere else? It's a rather opaque error message

@rootwork
Copy link

@v3nt I've been doing this myself (see #101) with gulp and it's working. Maybe it's something to do with your linter or webpack?

@pmowrer pmowrer closed this as completed Jun 6, 2021
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