dynamic inject css with javascript.
npm install dynamic-stylesheet
yarn add dynamic-stylesheet
import { injectCSS, updateCSS } from 'dynamic-stylesheet'
const styleText = ".container:before{ content:'before content' }"
// default insert to document.head
injectCSS(styleText)
// attach to element
injectCSS(styleText, { attachTo: document.body })
// updateCSS will use the same node with the same key
updateCSS(styleText, 'mark-key')
const updateStyleText = ".container:after{ content:'after content' }"
updateCSS(updateStyleText, 'mark-key')
MIT