Skip to content

Instantly share code, notes, and snippets.

View robsongajunior's full-sized avatar
🖥️
Born to Build and Deliver

ROBSON.JUNIOR robsongajunior

🖥️
Born to Build and Deliver
View GitHub Profile
@robsongajunior
robsongajunior / loadCSS.js
Created November 27, 2019 01:58 — forked from wad3g/loadCSS.js
Load CSS async via loadCSS.js
<script>
/*! loadCSS: load a CSS file asynchronously. [c]2016 @scottjehl, Filament Group, Inc. Licensed MIT */
(function(w){
"use strict";
/* exported loadCSS */
var loadCSS = function( href, before, media ){
// Arguments explained:
// `href` [REQUIRED] is the URL for your CSS file.
// `before` [OPTIONAL] is the element the script should use as a reference for injecting our stylesheet <link> before
// By default, loadCSS attempts to inject the link after the last stylesheet or script in the DOM. However, you might desire a more specific location in your document.