Skip to content

Option to use only css modules without $style. prefix #13

Closed
@non25

Description

@non25

Hi.

Amazing project.

Recently I started to really getting fed up with svelte's default style scoping, mostly due to it changing selectors weight thus making some intuitive css overrides unintuitive and the inability to override some leaf-component styles without wrapping it with divs...

Maintainers obsession with css properties and div wrapping is beyond me.

I like SFC format and the terseness of class="some-class" in the template in comparison to something like class="{style.someClass}".

What do you think about parsing to AST using svelte internal parser like it is done in svelte-trim and more safely changing classes in the markup through that ?

It would enable to safely omit $style. prefixes and get more "native" experience. 😁

In a perfect world that takes maintainers attitude towards other scoping mechanisms, or stripping whitespace I would love to see css modules included in svelte-preprocess to increase adoption and make it a drop-in replacement for svelte's native style scoping.

Another day one sad man in svelte chat wanted to strip base classes from a widget "scoped" styles to prevent outer page affecting the widget... Sent him a link to your preprocessor. 🙂

What do you think? 🤔

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions