mirror of
https://github.com/pheralb/svgl.git
synced 2025-03-14 09:00:34 +08:00
16 lines
416 B
TypeScript
16 lines
416 B
TypeScript
|
import { parseSvgContent } from '@/utils/parseSvgContent';
|
||
|
|
||
|
interface SvelteComponentParams {
|
||
|
lang: string;
|
||
|
content: string;
|
||
|
}
|
||
|
|
||
|
export const getSvelteCode = (params: SvelteComponentParams) => {
|
||
|
const { templateContent, componentStyle } = parseSvgContent(params.content, 'Svelte');
|
||
|
return `<script${params.lang ? ` lang="${params.lang}"` : ''}></script>
|
||
|
${templateContent}
|
||
|
|
||
|
${componentStyle}
|
||
|
`;
|
||
|
};
|