cssinjs / jss

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

[jss-isolate] Isoleted style is missing when using toString() #879

Closed palci12 closed 5 years ago

palci12 commented 5 years ago

Hi I preprocess JSS server side using toString(). I wanted to use "jss-isolate", but in final string isolate style is missing.

const jss = require('jss').default;
const isolate = require('jss-isolate').default;

jss.use(isolate());

const style = {
    button: {
        isolate: true,
        padding: [8, 10]
    }
};

const css = jss.createStyleSheet(style);

css.toString(); -> ".button-0-0-1 { padding: 8, 10; }"
kof commented 5 years ago

jss-isolate currently is not optimized for ssr, it uses its own sheet https://github.com/cssinjs/jss-isolate/blob/master/src/index.js#L103 and it doesn't exposes it for the user to stringify it for SSR.

Related issue is also https://github.com/cssinjs/jss/issues/647

kof commented 5 years ago

I think we should continue in the other issue