tiptap/packages/core/src/utils/injectCSS.ts
2020-03-30 10:42:59 +02:00

16 lines
379 B
TypeScript

export default function injectCSS(css: string) {
if (process.env.NODE_ENV !== 'test') {
const style = document.createElement('style')
style.type = 'text/css'
style.textContent = css
const { head } = document
const { firstChild } = head
if (firstChild) {
head.insertBefore(style, firstChild)
} else {
head.appendChild(style)
}
}
}