Created
March 29, 2021 14:32
-
-
Save jaschaio/321e794e7f8fb15d4bf9dfa0da46656c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8" /> | |
<meta name="viewport" content="width=device-width, initial-scale=1" /> | |
<meta name="description" content="Starter Snowpack App" /> | |
<title>Starter Snowpack App</title> | |
<script type='module' src="/index.js"></script> | |
</head> | |
<body> | |
<h1>Welcome to Snowpack!</h1> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { library, icon } from '@fortawesome/fontawesome-svg-core'; | |
const getIcon = async ( { icon: iconToFetch } ) => { | |
const { [ iconToFetch ]: importedIcon } = await import( `@fortawesome/free-brands-svg-icons/${ iconToFetch }.js` ); | |
library.add( importedIcon ); | |
return icon( importedIcon, { classes } ).html | |
} | |
( async () => { | |
const html = await getIcon( { icon: 'faFacebook' } ); | |
document.body.innerHTML = html; | |
} )(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "failed-to-resolve-example", | |
"version": "1.0.0", | |
"description": "", | |
"main": "index.js", | |
"dependencies": { | |
"@fortawesome/fontawesome-svg-core": "^1.2.35", | |
"@fortawesome/free-brands-svg-icons": "^5.15.3" | |
}, | |
"devDependencies": { | |
"snowpack": "^3.1.2" | |
}, | |
"scripts": { | |
"start": "snowpack dev", | |
"build": "snowpack build" | |
}, | |
"author": "", | |
"license": "ISC" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment