Skip to content

Commit

Permalink
fix: Properly import material icons with vite
Browse files Browse the repository at this point in the history
Signed-off-by: Julius Härtl <jus@bitgrid.net>
  • Loading branch information
juliusknorr committed Aug 30, 2024
1 parent 8ff0bc7 commit 9a62d02
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions src/shared/components/ncIconPicker/mixins/svgHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,12 @@
*/
export default {
methods: {
uriToSvg(dataUri) {
const pattern = /data:image\/svg\+xml;base64,/
const strippedUri = dataUri.replace(pattern, '')

return atob(strippedUri)
},
async getContextIcon(iconName) {
const { default: icon } = await import(
/* webpackChunkName: 'material-icons' */
/* webpackMode: 'lazy-once' */
`MaterialIcons/${iconName}.svg`
`./../../../../../img/material/${iconName}.svg?raw`
)

return this.uriToSvg(icon).replaceAll(/#fff/g, 'currentColor')
return icon.replaceAll(/#fff/g, 'currentColor')
},
},
}

0 comments on commit 9a62d02

Please sign in to comment.