3

Can anyone give me an example of how to use ion-icons in webpack using imports?

I've been struggling for a while with things like:

import 'ionicons/dist/ionicons.js';
...
<ion-icon name='add' />

And nothing seems to be working, even after looking at the cryptic source code inside the npm package.

Please help?

P.s.: please don't suggest including the external script, an npm package should be usable via imports, and not: <script src="https://unpkg.com/ionicons@5.0.0/dist/ionicons.js"></script>

Cosmin Atanasiu
  • 2,532
  • 3
  • 21
  • 26

1 Answers1

0

You can import most of the icons as svgs:

import {logoTwitter} from "ionicons/icons";
var q = document.querySelector("#blankdiv")
q.innerHTML = `<a href="">${logoTwitter.slice(s.indexOf('<'))}</a>`

Unfortunately, this seems to not work with some, such as refresh.

Kyouma
  • 320
  • 6
  • 14