ready-state-stylesheet
v1.1.1
Published
Load a stylesheet once the document ready state is complete to prevent blocking rendering (useful for lazy loading web fonts)
Downloads
12
Readme
ready-state-stylesheet
Load a stylesheet once the document ready state is complete to prevent blocking rendering (useful for lazy loading web fonts)
Usage
import readyStateStylesheet from 'ready-state-stylesheet'
const stylesheetUrl = 'https://fonts.googleapis.com/css?family=Roboto'
readyStateStylesheet(stylesheetUrl)
// or provide a callback
readyStateStylesheet(stylesheetUrl, function () {
document.documentElement.classList.add('fonts-loaded')
})
License
MIT