A lightweight Web Component wrapper for Font Awesome
- Supports Free and Pro icon sets
- Uses the Font Awesome CDN
- Supports self-hosted font-awesome assets
<script type="module" src="/node_modules/@gluon/font-awesome/font-awesome.js"></script>
<font-awesome icon="fas fa-camera-retro fa-7x"></font-awesome>
import '/node_modules/@gluon/font-awesome/font-awesome.js';
class MyElement extends HTMLElement {
get template() {
return html`<p>Take a picture! <font-awesome icon="fas fa-camera-retro"></font-awesome></p>`;
}
// ...
}
<script>window.FontAwesome = { pro: true };</script>
<script type="module" src="/node_modules/@gluon/font-awesome/font-awesome.js"></script>
<font-awesome icon="fal fa-camera-retro fa-7x"></font-awesome>
npm install @fortawesome/fontawesome-free
<script>window.FontAwesome = { path: '/node_modules/@fortawesome/fontawesome-free' };</script>
<script type="module" src="/node_modules/@gluon/font-awesome/font-awesome.js"></script>
<font-awesome icon="fal fa-camera-retro fa-7x"></font-awesome>
Gluon-font-awesome is available from npm as @gluon/font-awesome
npm install @gluon/font-awesome
Works on all modern browsers, and IE11. May require some polyfills and/or bundling.
See rollup.config.js
and index.html
for example bundling and polyfill usage.
Copyright © 2017-present, Goffert van Gool