Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
967 views
in Technique[技术] by (71.8m points)

material design - missing icons with Snowpack + Svelte + svelte-materialify

I am trying to get snowpack to work with svelte-materialify. I created an app with create-snowpack-app svelte-snowpack --template @snowpack/app-template-svelte, followed by yarn install svelte-materialify.

All the CSS seem to work, a simple MaterialApp with a demo AppBar works: CSS, light/dark theme, animations etc. - except that the icons are completely missing. No error in Js console.

On the snoepack site, there are examples for webpack and rollup - these don't seem to be necessary for snowpack - the postcss plugin is already activated, and seems to do the trick here. So, everything fine, except for icons.

Any thoughts?

question from:https://stackoverflow.com/questions/65849920/missing-icons-with-snowpack-svelte-svelte-materialify

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Alternative solution First you have to install the icons package

npm install --save svelte-icons

then you have to import each icon separately Example

<script>
   import MdShoppingCart from 'svelte-icons/md/MdShoppingCart.svelte'
   <MdShoppingCart/>
</script>

For more icons enter this link https://svelte-icons.vercel.app/

Choose a library, and click on the icon to get the import code then use it as a tag


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...