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

Unfortunately nesting is not supported by styled-jsx #310

Closed
juanigallo opened this issue Oct 12, 2017 · 9 comments
Closed

Unfortunately nesting is not supported by styled-jsx #310

juanigallo opened this issue Oct 12, 2017 · 9 comments

Comments

@juanigallo
Copy link

Hi there !

.a { p { color: red; } }

The code above is throwing the error: Unfortunately nesting is not supported by styled-jsx

Is any plan to support nesting in styled-jsx ? Or is there a workaround to fix this ?

Thanks !

@juanigallo
Copy link
Author

Just saw #190 but I think that the issue is still valid.

@huv1k
Copy link

huv1k commented Oct 13, 2017

You can use postcss in meanwhile

@giuseppeg
Copy link
Collaborator

styled-jsx is never going to support non standard CSS features, however soon (like this weekend) I will release a new version that introduces a plugin system which will allow to use SASS, PostCSS or really processing your styles as you please - I already wrote two sample plugins
https://github.com/giuseppeg/styled-jsx-plugin-sass
https://github.com/giuseppeg/styled-jsx-plugin-postcss

@juanigallo
Copy link
Author

Thanks for the answer. I will try de sass plugin.

@corysimmons
Copy link

corysimmons commented Dec 22, 2017

https://github.com/giuseppeg/styled-jsx-plugin-postcss + postcss-cssnext = W3C spec nesting

.foo {
  & .bar {
    background: blue;
  }
}

@scythargon
Copy link

Still can't setup this ><
installed styled-jsx-plugin-postcss, added it to babel config, and postcss-preset-env (which replaces postcss-cssnext nowadays)

created postcss.config.js:

module.exports = {
  parser: 'sugarss',
  plugins: {
    'postcss-plugin': {},
    'postcss-preset-env': {},
  }
}

Now I get:
image

but still
image

Can you please tell me where am I wrong?

@corysimmons
Copy link

module.exports = {
  parser: 'sugarss',
  plugins: {
    'postcss-plugin': {}, // I suspect this should be 'styled-jsx-plugin-postcss': {}
    'postcss-preset-env': {},
  }
}

tbh, I'm not sure. It's a pain to get setup and working right.

I jumped to Emotion and haven't looked back. https://github.com/zeit/next.js/tree/canary/examples/with-emotion

@ekanant
Copy link

ekanant commented Feb 28, 2019

When I import bootstrap.css from node_modules It has error

Error: Nesting detected at 31452:1. Unfortunately nesting is not supported by styled-jsx.

I found that the error is from this style, It's from navbar bootstrap 4, How can I fix this?

.navbar-dark .navbar-toggler-icon {
  background-image: url("data:image/svg+xml,%3csvg viewBox='0 0 30 30' xmlns='http://www.w3.org/2000/svg'%3e%3cpath stroke='rgba(255, 255, 255, 0.5)' stroke-width='2' stroke-linecap='round' stroke-miterlimit='10' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

.navbar-light .navbar-toggler-icon {
  background-image: url("data:image/svg+xml,%3csvg viewBox='0 0 30 30' xmlns='http://www.w3.org/2000/svg'%3e%3cpath stroke='rgba(0, 0, 0, 0.5)' stroke-width='2' stroke-linecap='round' stroke-miterlimit='10' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

@itsthomas
Copy link

Yes, the problem happens if you try to use an svg image as background.
Is there any solution for this?

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

7 participants