Skip to content

Instantly share code, notes, and snippets.

@kof
Created July 11, 2018 17:38
Show Gist options
  • Save kof/95590050383c41eeebe60cb378a1ecc7 to your computer and use it in GitHub Desktop.
Save kof/95590050383c41eeebe60cb378a1ecc7 to your computer and use it in GitHub Desktop.
static jss as a raw css string
// source js
const styles = {
static: {
color: 'green'
},
mixed: {
color: 'red',
margin: (props) => props.spacing
}
}
createStyleSheet(styles).attach()
// generated js
const styles = {
'@raw': `
.static-0-0-1 {
color: green;
}
.mixed-0-0-2 {
color: red;
}
`,
mixed: {
margin: (props) => props.spacing
}
}
const {classes} = createStyleSheet(styles, {
classes: {
static: 'static-0-0-1',
mixed: 'mixed-0-0-2'
}
}).attach()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment