You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Api for script[src] & style[src] attributes to break up large components & support compiled languages (e.g. Typescript) using vendor tools (no preprocessor necessary)
#4026
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.
This seems to be a discussion in it's own right & I didn't want to distract from the discussion on the svelte-ts thread.
My personal experience. I recently have been working on an Angular project & I have to say that having separate *.ts, *.html, *.scss files is not too bad, especially when components are large.
Perhaps, svelte could offer an api to have the contents of the <script> tag defined with a function that can be defined in a *.ts file. Same with <script context=module>.
This way, one can use tsc -w for the fastest typescript compilation performance while interfacing with Svelte. Such an api could also assist with svelte-ts.
The typescript compiler will have a chance to compile MyComponent.ts to MyComponent.js & MyComponent.module.ts to MyComponent.module.js.
The svelte compiler would then copy the contents of MyComponent.js & MyComponent.component.js & place the contents inside the respective <script> tags. The src attribute would keep the semantics of scoping to be within the component as well.
In the case of svelte-ts, the compiler can implicitly create MyComponent.ts from the typescript contents of the <script> tag. This way, the Svelte library has an explicit contract on handling other languages such as typescript, livescript, coffeescript, etc. while using the standard cli tools for these libraries & not having to resort to preprocessors.
This also seems fairly simple to implement from the current svelte implementation.
Love to hear any thoughts...
The text was updated successfully, but these errors were encountered:
btakita
changed the title
Api for script[src] attribute to break up large components & support compiled languages (e.g. Typescript) using vendor tools (no preprocessor necessary)
Api for script[src] attribute to break up large components & support compiled languages (e.g. Typescript) using vendor tools (no preprocessor necessary)
Nov 30, 2019
btakita
changed the title
Api for script[src] attribute to break up large components & support compiled languages (e.g. Typescript) using vendor tools (no preprocessor necessary)
Api for script[src] & style[href] attributes to break up large components & support compiled languages (e.g. Typescript) using vendor tools (no preprocessor necessary)
Nov 30, 2019
btakita
changed the title
Api for script[src] & style[href] attributes to break up large components & support compiled languages (e.g. Typescript) using vendor tools (no preprocessor necessary)
Api for script[src] & style[src] attributes to break up large components & support compiled languages (e.g. Typescript) using vendor tools (no preprocessor necessary)
Nov 30, 2019
Moved from #3677
This seems to be a discussion in it's own right & I didn't want to distract from the discussion on the
svelte-ts
thread.My personal experience. I recently have been working on an Angular project & I have to say that having separate
*.ts
,*.html
,*.scss
files is not too bad, especially when components are large.Perhaps, svelte could offer an api to have the contents of the <script> tag defined with a function that can be defined in a
*.ts
file. Same with <script context=module>.This way, one can use
tsc -w
for the fastest typescript compilation performance while interfacing with Svelte. Such an api could also assist with svelte-ts.It could look something like:
MyComponent.svelte
MyComponent.ts
MyComponent.module.ts
The typescript compiler will have a chance to compile
MyComponent.ts
toMyComponent.js
&MyComponent.module.ts
toMyComponent.module.js
.The svelte compiler would then copy the contents of
MyComponent.js
&MyComponent.component.js
& place the contents inside the respective<script>
tags. Thesrc
attribute would keep the semantics of scoping to be within the component as well.In the case of svelte-ts, the compiler can implicitly create
MyComponent.ts
from the typescript contents of the<script>
tag. This way, the Svelte library has an explicit contract on handling other languages such as typescript, livescript, coffeescript, etc. while using the standard cli tools for these libraries & not having to resort to preprocessors.This also seems fairly simple to implement from the current svelte implementation.
Love to hear any thoughts...
The text was updated successfully, but these errors were encountered: