Skip to content

Instantly share code, notes, and snippets.

@chrislloyd
Created August 19, 2015 22:56
Show Gist options
  • Save chrislloyd/55f6d77ef5ec5804acf7 to your computer and use it in GitHub Desktop.
Save chrislloyd/55f6d77ef5ec5804acf7 to your computer and use it in GitHub Desktop.
function cssmodularize(strings) {
/* TODO: Un-stub */
return {
'.foo': 'Button-foo-abcd'
}
}
class Button {
static styles = cssmodularize`
.foo { /* ... */ }
`
render() {
const s = this.constructor.styles
console.log(s)
// ...
}
}
const button = new Button()
button.render()
@chrislloyd
Copy link
Author

Why is this awesome? Separation of concerns. Everything concerning a button is in the one file. Syntax highlighting might be a bitch, but that can come later (hey, it happened for JSX).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment