0.0.0-beta.10 • Published 6 years ago

styled-css-loader v0.0.0-beta.10

Weekly downloads
2
License
MIT
Repository
github
Last release
6 years ago

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>
)