How to use fg-loadcss - 10 common examples

To help you get started, we’ve selected a few fg-loadcss examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github localnerve / react-pwa-reference / src / application / client / inline.js View on Github external
})
    .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);
}
github dfinityexplorer / dfinityexplorer / web / src / Home.js View on Github external
componentDidMount() {
    super.componentDidMount();

    this.isComponentMounted = true;

    // Load fonts.
    loadCSS(
      Constants.URI_CDN_GOOGLE_FONTS,
      document.querySelector('#insertion-point-jss')
    );
  }
github dfinityexplorer / dfinityexplorer / web / src / App.js View on Github external
componentDidMount() {
    // Load fonts.
    loadCSS(
      Constants.URI_CDN_GOOGLE_FONTS,
      document.querySelector('#insertion-point-jss')
    );
  }
github didclab / onedatashare / src / main / react-front-end / src / views / Transfer / BrowseModuleComponent.js View on Github external
componentDidMount(){
		loadCSS(
	      'https://use.fontawesome.com/releases/v5.1.0/css/all.css',
	      document.querySelector('#font-awesome-css'),
	    );
	}
github LWJGL / lwjgl3-www / client / app / routes / guide / Guide.js View on Github external
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>
github learningequality / kolibri / kolibri / core / assets / src / core-app / asset-loader.js View on Github external
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));
    }
  });
};
github dfinityexplorer / dfinityexplorer / web / src / Components / Footer / Footer.js View on Github external
componentDidMount() {
    super.componentDidMount();

    loadCSS(Constants.URI_CDN_FONT_AWESOME, document.querySelector('#insertion-point-jss'));
  }
github mui-org / material-ui / docs / src / pages / components / icons / FontAwesome.tsx View on Github external
React.useEffect(() => {
    loadCSS(
      'https://use.fontawesome.com/releases/v5.1.0/css/all.css',
      document.querySelector('#font-awesome-css'),
    );
  }, []);
github colinrotherham / core / app / assets / js / critical.js View on Github external
/**
 * Start critical modules
 */

import loadCSS from 'fg-loadcss';

window.loadCSS = loadCSS.loadCSS;
github mui-org / material-ui / docs / src / pages / components / icons / FontAwesome.js View on Github external
React.useEffect(() => {
    loadCSS(
      'https://use.fontawesome.com/releases/v5.1.0/css/all.css',
      document.querySelector('#font-awesome-css'),
    );
  }, []);

fg-loadcss

A function for loading CSS asynchronously

MIT
Latest version published 5 years ago

Package Health Score

58 / 100
Full package analysis

Similar packages