scoped-style
•
1 min read
GitHub link: https://github.com/sadick254/scoped-style
A new kid on the CSS in JS block.
Plays nicely with Preact, React, Hyperapp and InfernoJS.
An example from the readme for React:
import React from "react"import scoped from "scoped-style"
const styled = scoped(React.createElement)
// define global cssstyled.global` * { margin: 0; }
html, body { width: 100%; height: 100%; }`;
// and scoped cssconst Button = styled("button")` background: ${props => props.primary ? "orange": "gray"}; border: none; border-radius: 2px; :hover { padding: 10px; }`
const App = () => ( <div> <Button primary>Login</Button> </div>)
// Your rendering code