Load a CSS file dynamically.
Usage:
import { loadCSS } from "mazey";loadCSS( "http://example.com/path/example.css", { id: "iamid", // Optional, link ID, default none } ) .then( res => { console.log(`Load CSS Success: ${res}`); } ) .catch( err => { console.error(`Load CSS Fail: ${err.message}`) } ); Copy
import { loadCSS } from "mazey";loadCSS( "http://example.com/path/example.css", { id: "iamid", // Optional, link ID, default none } ) .then( res => { console.log(`Load CSS Success: ${res}`); } ) .catch( err => { console.error(`Load CSS Fail: ${err.message}`) } );
Output:
Load CSS Success: loaded Copy
Load CSS Success: loaded
URL of the CSS resource.
Optional
Optional ID for the <link> element.
<link>
A promise that resolves to "loaded" after the stylesheet loads.
"loaded"
Load a CSS file dynamically.
Usage:
Output: