npm install postcss-styled --save-dev
const postcss = require ( 'postcss' ) ;
const stylelint = require ( 'stylelint' ) ;
const syntax = require ( 'postcss-styled' ) ( {
// syntax for parse css blocks (non-required options)
css : require ( 'postcss-safe-parser' ) ,
} ) ;
postcss ( [ stylelint ( { fix : true } ) ] ) . process ( source , { syntax : syntax } ) . then ( function ( result ) {
// An alias for the result.css property. Use it with syntaxes that generate non-CSS output.
result . content
} ) ;
import styled from 'styled-components' ;
const Title = styled . h1 `
font-size: 1.5em;
text-align: center;
color: palevioletred;
` ;
import styled from 'styled-components' ;
const Title = styled . h1 `
font-size: 1.5em;
text-align: center;
color: palevioletred;
` ;