styletron-loader
Webpack loader to load CSS into a styletron compatible CSS object by specifying a string with CSS selectors.
Very much inspired by:
Install
npm install -D styletron-loader
or
yarn add --dev styletron-loader
Usage
Documentation: Using loaders
Create an entry to load .css
files in your webpack.config:
module: loaders: test: /\.css$/ loaders: 'styletron-loader' exclude: /node_modules/
Requiring CSS rules:
{}
var util = ;var parsedCSS = ; parsedCSS'.button'/*{ 'font-size': '1.5em', color: 'fuchsia', ':hover': { color: 'crimson' }, ':focus': { color: 'crimson' }, '@media screen and (max-width: 768px)': { 'font-size': '2em' }}*/ var styles = ; ;/*{ 'font-size': '1.5em', color: 'fuchsia', ':hover': { color: 'crimson' }, ':focus': { color: 'crimson' }, '@media screen and (max-width: 768px)': { 'font-size': '2em' }, 'background-color': 'red'}*/