mirror of
https://github.com/lucide-icons/lucide.git
synced 2025-12-22 03:59:24 +01:00
Lucide Svelte Package! (#476)
* init svelte project * Add export script for lucide-svelte * make lucide-svelte wokring * make ready for first release * update lock file * bump version * some fixes in the build * Add tests * Finish tests * Update Readme * update lock file * Add svelte to gh actions * Add svetle to website docs * Add test ci script * adjust action * add on PR trigger * remove dep * fix tests * Add svelte entry in package.json * update snapshots
This commit is contained in:
17
packages/lucide-svelte/scripts/exportTemplate.js
Normal file
17
packages/lucide-svelte/scripts/exportTemplate.js
Normal file
@@ -0,0 +1,17 @@
|
||||
// eslint-disable-next-line import/no-extraneous-dependencies
|
||||
import { stringify } from 'svgson';
|
||||
|
||||
export default ({ iconName, children }) => {
|
||||
const iconChildNodes = children.map(([name, attributes]) => ({ name, attributes, children: [] }));
|
||||
const iconChildrenHTML = iconChildNodes.map(stringify).join('\n ');
|
||||
return `\
|
||||
<script>
|
||||
import Icon from '../Icon.svelte';
|
||||
</script>
|
||||
|
||||
<Icon name="${iconName}" {...$$props} >
|
||||
${iconChildrenHTML}
|
||||
<slot/>
|
||||
</Icon>
|
||||
`;
|
||||
};
|
||||
Reference in New Issue
Block a user