Skip to content

Locally defined script tag within tags #9453

@OTheNonE

Description

@OTheNonE

Describe the problem

#snippet is a feature i’ve really wanted, great news! Related to this feature, is that i’ve found myself defining many locally used objects inside the global script tag in a +page, which could just as well been defined locally in a tag and only be used there. I have no idea about the complications of this, but may this be considered in some version of Svelte?

Describe the proposed solution

It would be awesome to define local script tags or just local variables, either within a tag in a +page or a #snippet, or both. Here is a small example: https://svelte.dev/repl/8492f743da224435b860620f74096991?version=4.2.3

Alternatives considered

Components can be used to solve this, but I think these would not fit these cases properly.

Importance

nice to have

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions