css-in-js icon indicating copy to clipboard operation
css-in-js copied to clipboard

Invalid JavaScript syntax if the CSS property has a single-quote

Open eXon opened this issue 7 years ago • 2 comments

First and foremost, awesome plugin I love it!

There is a problem that is slightly anoying though. When the CSS property is containing a single-quote, the JavaScript syntax is incorrect.

Example: if you transform: content: '';, the output will be content: '''', (4 single-quotes) which is incorrect. It should be either content: '""', or content: '\\\'\\\'',.

The worst example would be: content: 'I\'m bugged'; that will be transformed to content: ''I\'m bugged'',. It should be transformed to: '\'I\\\'m bugged\'', or '"I\\\'m bugged"'.

Or maybe it would be easier to use the backtick (`) in those situations.

eXon avatar Aug 07 '17 16:08 eXon

Thanks for the issue, I think @gdad-s-river is working on this.

ansumanshah avatar Aug 11 '17 12:08 ansumanshah

Terrific library! Thanks :)

yonibot avatar Sep 02 '17 08:09 yonibot