styled-css-loader
v0.0.0-beta.10
Published
Loader that modularize, export and enables easy theming css
Downloads
7
Readme
Styled css loader
Theme and use css fastly
Getting Started
Installation
$ npm install --save styled-css-loader
or
$ yarn add styled-css-loader
Usage
/* webpack-config.js */
module.exports = {
module: {
rules: [
{
test: /\.css/,
loader: 'styled-css-loader',
}
]
}
}
/* home.css */
.page {
background: --colorPrimary;
}
.title {
color: white;
}
/* home.js */
import s, { sheet } from './home.css'
import compile from 'styled-css-loader/compile'
// You can also use <style>{sheet.css}</style>
const Home = () => (
<div className={s.page}>
<style>{compile(sheet, { colorPrimary: '#333' })}</style>
<h1 className={s.title}>Home</h1>
</div>
)