Skip to main content
Create new
Introduction
Reactivity
Props
Logic
Events
Bindings
Lifecycle
Stores
Motion
Transitions
Animations
Easing
SVG
Actions
Classes
Component composition
Context API
Special elements
Module context
Debugging
7GUIs
Miscellaneous
App.svelte
<script>
let patternstr = `<pattern width="1" height="1" patternContentUnits="objectBoundingBox" id="patternx1">
<rect width="1" height="1" fill="red"></rect>
</pattern>`
let patterns = {p: patternstr}
let patternstr2 = `<pattern width="1" height="1" patternContentUnits="objectBoundingBox" id="patternx2">
<rect width="1" height="1" fill="red"></rect>
</pattern>`
</script>

<svg width="64" height="64" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64" preserveAspectRatio="none">
<defs>
{#each Object.entries(patterns) as [p, pattern]}
{@html pattern}
{/each}
</defs>
<rect width="64" height="64" fill="url(#patternx1)" stroke="black" stroke-width="2px"></rect>
</svg>
<svg width="64" height="64" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64" preserveAspectRatio="none">
<defs>
{@html patternstr2}
</defs>
<rect width="64" height="64" fill="url(#patternx2)" stroke="black" stroke-width="2px"></rect>
</svg>
loading Svelte compiler...
/* Select a component to see its compiled code */
result = svelte.compile(source, {
generate: ,
});
/* Select a component to see its compiled code */