cssinjs / jss

JSS is an authoring tool for CSS which uses JavaScript as a host language.
https://cssinjs.org
MIT License
7.08k stars 399 forks source link

Asterisk selector has escaped output #1226

Closed shash7 closed 4 years ago

shash7 commented 4 years ago

Expected behavior:

* {
color: 'red';
}

Describe the bug: When I use the asterisk selector and output the stylesheet via toString, the output class name is escaped:

const styles = {
            " * ": {
                color: "red"
            }
        };
        var obj = jss.createStyleSheet(styles);
        console.log(obj);
        var style = obj.toString();

Output:

.\ \*\ -0-0-1 {
  color: "red";
}

Versions:

shash7 commented 4 years ago

Hmm, actually all selectors have string escape issues when I use the toString() method. Anyone knows a workaround?

HenriBeck commented 4 years ago

I think what you are looking here for is the jss-plugin-global.