Skip to content

Support self-closing <style> tag #5080

Closed
@rondonjon

Description

@rondonjon

I am using a preprocessor to import styles in SCSS into my Svelte components.

Some of the stylesheets have grown rather big, so eventually I started to swap them out as follows:

<style lang="scss">
  @import "./CheckBox.scss";
</style>

Out of curiosity I tried out something shorter and was surprised that it actually worked:

<style lang="scss" src="./CheckBox.scss"></style>

One minor point that still bothers me is that the compiler raises an error when I try to make the tag self-closing. The following is currently not possible:

<style lang="scss" src="./CheckBox.scss" />

Output from svelte-loader:

ERROR in ./src/CheckBox/CheckBox.svelte
Module build failed (from /......./node_modules/svelte-loader/index.js):
Error: ParseError: Expected > (13:41)
11: </script>
12: 
13: <style lang="scss" src="./CheckBox.scss" />

I think it would be nice to have that supported.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions