mirror of
https://github.com/lucide-icons/lucide.git
synced 2026-11-14 13:58:21 +00:00
improve icon node imports
This commit is contained in:
@@ -35,12 +35,12 @@
|
||||
"version": "pnpm version --git-tag-version=false"
|
||||
},
|
||||
"devDependencies": {
|
||||
"prettier": "^2.3.2",
|
||||
"svgson": "^5.2.1",
|
||||
"@lucide/build-icons": "workspace:*",
|
||||
"@lucide/rollup-plugins": "workspace:*",
|
||||
"@lucide/helpers": "workspace:*",
|
||||
"@lucide/rollup-plugins": "workspace:*",
|
||||
"prettier": "^2.3.2",
|
||||
"rollup": "^4.22.4",
|
||||
"rollup-plugin-dts": "^6.1.0"
|
||||
"rollup-plugin-dts": "^6.1.0",
|
||||
"svgson": "^5.2.1"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ export default ({ iconName, children, getSvg, deprecated, deprecationReason }) =
|
||||
const exportName = toCamelCase(iconName)
|
||||
|
||||
return `
|
||||
import { IconNode } from '../types';
|
||||
/**
|
||||
* @name ${iconName}
|
||||
* @description Lucide SVG string.
|
||||
@@ -17,8 +18,8 @@ export default ({ iconName, children, getSvg, deprecated, deprecationReason }) =
|
||||
* @returns {IconNode}
|
||||
* ${deprecated ? `@deprecated ${deprecationReason}` : ''}
|
||||
*/
|
||||
const ${exportName}: string = ${JSON.stringify(children)}
|
||||
const _${exportName}: string = ${JSON.stringify(children)}
|
||||
|
||||
export default ${exportName};
|
||||
export default _${exportName};
|
||||
`;
|
||||
};
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
// className is not supported in svg elements
|
||||
export type SVGProps = Record<string, string | number>;
|
||||
export type IconNodeChild = readonly [tag: string, attrs: SVGProps];
|
||||
export type IconNode = readonly [tag: string, attrs: SVGProps, children?: IconNodeChild[]];
|
||||
export type Icons = { [key: string]: IconNode };
|
||||
Reference in New Issue
Block a user