Skip to content

Latest commit

 

History

History
55 lines (37 loc) · 1.13 KB

README.md

File metadata and controls

55 lines (37 loc) · 1.13 KB

styled-sanitize

Single file with sanitize.css for your styled-components

Original sanitize.css copied and adapted from jonathantneal/sanitize.css

Usage

npm install --save styled-sanitize styled-components

JavaScript

// ----- styles/index.js
import styledSanitize from 'styled-sanitize'
import { injectGlobal } from 'styled-components'

export default () => injectGlobal`
  ${styledSanitize}

  body {
    padding: 0;
    background-color: black;
  }
`

// ----- client.js
// ... imports
import baseStyles from './styles/index'

const render = () => {
  baseStyles()

  ReactDOM.render(<AppContainer />, document.getElementById('app-root'))
}

render()

With named import

// ES Modules
import { sanitize, version } from 'styled-sanitize'

// CommonJS
const { sanitize, version } = require('styled-sanitize')

ServerSide Rendering

Styled-components supports SSR, you can read discussion or open RURARAR