A mostly compile-time CSS in JS library, in progress!
yarn add static-style-sheets
- Configure in Babel config:
// in .babelrc / babel.config.js / etc
module.exports = {
plugins: ['static-style-sheets/plugin'],
}
- Use within your code!
import styles from 'static-style-sheets'
const className = styles({
color: 'blue',
})
export function Button() {
return <button className={className}>Click Here!</button>
}
- The result of calling
styles
may return multiple classnames, don't depend on it returning a single classname! - For the moment, the argument (an object of CSS styles) passed to
styles
must be entirely static
- Typescript
- Babel
- Jest