Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
})
.catch((error) => {
console.error('font failed to load: ', error);
});
} else {
// Just let font-face work normally.
docEl.className += ' fonts-loaded';
}
// --------------------------------------------------
// Load non-critical stylesheets
//
const cssHrefs = document.querySelectorAll('meta[content$=".css"]');
for (let i = 0; i < cssHrefs.length; i++) {
loadCSS(cssHrefs[i].content);
}
componentDidMount() {
super.componentDidMount();
this.isComponentMounted = true;
// Load fonts.
loadCSS(
Constants.URI_CDN_GOOGLE_FONTS,
document.querySelector('#insertion-point-jss')
);
}
componentDidMount() {
// Load fonts.
loadCSS(
Constants.URI_CDN_GOOGLE_FONTS,
document.querySelector('#insertion-point-jss')
);
}
componentDidMount(){
loadCSS(
'https://use.fontawesome.com/releases/v5.1.0/css/all.css',
document.querySelector('#font-awesome-css'),
);
}
import React from 'react'
import Helmet from 'react-helmet'
import { Link } from 'react-router/es6'
import codeSample from './sample'
import { loadCSS } from 'fg-loadcss'
import { highlight } from 'highlight.js'
if ( process.browser ) {
loadCSS('//cdn.jsdelivr.net/highlight.js/9.5.0/styles/darkula.min.css');
}
const codeSampleHtml = highlight('java', codeSample);
export default class extends React.Component {
render() {
return (
<main>
<section></section></main>
assets.forEach(asset => {
if (asset.indexOf('.css') === (asset.length - 4)) {
const stylesheet = loadcss(asset);
onloadcss(stylesheet, () => cb(asset, true));
setTimeout(() => cb(asset, false), timeout);
} else if (asset.indexOf('.js') === (asset.length - 3)) {
scriptjs(asset, () => cb(asset, true), () => cb(asset, false));
}
});
};
componentDidMount() {
super.componentDidMount();
loadCSS(Constants.URI_CDN_FONT_AWESOME, document.querySelector('#insertion-point-jss'));
}
React.useEffect(() => {
loadCSS(
'https://use.fontawesome.com/releases/v5.1.0/css/all.css',
document.querySelector('#font-awesome-css'),
);
}, []);
/**
* Start critical modules
*/
import loadCSS from 'fg-loadcss';
window.loadCSS = loadCSS.loadCSS;
React.useEffect(() => {
loadCSS(
'https://use.fontawesome.com/releases/v5.1.0/css/all.css',
document.querySelector('#font-awesome-css'),
);
}, []);