-
Notifications
You must be signed in to change notification settings - Fork 149
Option to define default lang
for script
& style
tags.
#184
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Hey @grundmanise 👋 ! I'm an advocate for explicitness, but I also understand the pain of repeatedly typing those attributes (even though it's just a few characters). However, the first problem that comes to my mind is how IDEs are supposed to know how it should highlight the scss/typescript/etc syntax. There's also the possibility to add a {
preprocess: [scss({ force: true }), typescript({ force: true })]
} But again, I'm always inclined to vote for explicitness. |
Hey 👋 @kaisermann! I feel you, and I'm also for explicitness. Though here, if TS is the chosen language for the project, then devs would know that it's being used instead of plain JS. On the other hand, if the product is in the transitional state JS -> TS, explicit Ah yes...IDEs.. TBH I don't know on what heuristics (except obvious - file extensions) IDEs rely to derive the language. That could be a tough one. |
Yeah, I think adding this could affect the DX of a project, which is something I'd rather not do. However, with that said, you can always skip the exported processor and call the typescript transformer directly in a custom preprocessor 👀 : // rollup.config.js
import tsTransformer from 'svelte-preprocess/dist/transformers/typescript.js';
import scssTransformer from 'svelte-preprocess/dist/transformers/scss.js';
export default {
...,
plugins: [
svelte({
preprocess: [
{
script({ content, filename }) {
return tsTransformer({
content,
filename,
options: {
/* ts options */
},
});
},
style({ content, filename }) {
return scssTransformer({
content,
filename,
options: {
/* scss options */
},
});
},
},
],
}),
],
}; |
Is your feature request related to a problem? Please describe.
Option to define default
lang
forscript
&style
tags.Writing
lang='scss'
/lang='typescript'
could be tedious, it would be nice if there would be an option to define defaultlangs
so that those wouldn't have to be specified in the tags each time.Describe the solution you'd like
Treat
<script>
as though it is<script lang='typescript'>
, if default langtypescript
for script is specified.Treat
<style>
as though it is<style lang='scss'>
, if default langscss
for style is specified.How important is this feature to you?
Nice to have.
The text was updated successfully, but these errors were encountered: