6

I use Next.js with styled-jsx together with stylelint and everything goes well until when I start to use variables in styled-jsx because stylelint throw stylelint(CssSyntaxError) on those variables.

For example

const Button = ({ color }) => (
  <>
    <button>Hello World!</button>

    <style jsx>{`
      button {
        color: ${color || 'blue'};
                 ^^^^^ Unknown word (CssSyntaxError)
      }
    `}</style>
  </>
)

I don't know how to fix it or is it have any plugins that can help.

Lpaydat
  • 406
  • 5
  • 8

0 Answers0