sveltejs / svelte-preprocess

A ✨ magical ✨ Svelte preprocessor with sensible defaults and support for: PostCSS, SCSS, Less, Stylus, Coffeescript, TypeScript, Pug and much more.
MIT License
1.73k stars 147 forks source link

Having the option to set a default lang for the `style` and `script` tags #550

Closed smithliam closed 1 year ago

smithliam commented 1 year ago

Hi I didn't find anything related to this in the docs so🤷‍♂️

Is your feature request related to a problem? Please describe.

I don't want to write lang="postcss" every single time I want to use a style tag.

Describe the solution you'd like

Having options like this:

preprocess({
  styleTagDefaultLang: 'postcss',
  scriptTagDefaultLang: 'typescript',
  templateTagDefaultLang: 'pug',
})

Describe alternatives you've considered

_

How important is this feature to you?

It is so annoying, I use postcss because I use Tailwindcss, so it's necessary for me to add this lang attr. These days everyone uses Tailwind, so it will be awesome for everyone to have the option...

Additional context

Please and thank you.

kaisermann commented 1 year ago

Hey @smithliam 👋 We had this functionality in the past, and it's an enormous can of worms for tooling. It's really hard for, i.e, the Svelte VS Code extension to know how to parse your tags. I can see how it can be a bit annoying to add the lang attribute to your tags when you're coding a project from scratch, but I'm afraid we won't reconsider adding this again.

You're free, however, to write your own postcss preprocessor or use something like: https://www.npmjs.com/package/svelte-preprocess-postcss

These days everyone uses Tailwind, so it will be awesome for everyone to have the option...

I'm afraid this is only an assumption.