Templarian / MaterialDesign-JS

Dist for Material Design Icons JS/TypeScript
Other
161 stars 18 forks source link

How to use it without node #14

Closed hasanAjsf closed 3 years ago

hasanAjsf commented 3 years ago

I installed the module as:

npm install @mdi/js

And want to use it in my template that is running in a server built with GO lang, so i wrote the below:

<script type="module" src="./node_modules/@mdi/js/mdi.js"></script>

Bob lives in a <span class="mdi mdi-home"></span>.

But no icon shown up!

I even failed with

<script>
     import { mdi-home } from './node_modules/@mdi/js/mdi.js';
<script>
Templarian commented 3 years ago

This package is not aimed at being consumed directly in the browser as we only provide a ES6 module.

We have plans to build out something a little more ideal for this situation, but have not had time to write out. You might be stuck using the webfont for now.

What you are trying to do would include all the icons and would be very heavy as there are almost 6k icons.

https://dev.materialdesignicons.com/guide/webfont-alternatives Some alternatives.