Skip to content
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

Allow separated input of HTML, CSS and JS in addition of Single File Components #92

Closed
rhengles opened this issue Dec 2, 2016 · 5 comments

Comments

@rhengles
Copy link

rhengles commented Dec 2, 2016

Hello!

I realize I could create a preprocessor step to assemble a virtual single file component before passing it to Svelte, but I'd like to ask here if it is possible to add support to input each part of a component separately instead of in a single file.

My team at the company I work for recently created a fairly large Vue 2 app, with several tens' of components, and we greatly prefer keeping each part of the component - html, css and js - in its own file. Each one of them can easily go over a few hundred lines, so it's not optimal (in our opinion) for reading, editing, searching, organizing and versioning.

Despite the default recommendation from Vue of using SFC's with vue-loader, since it does not depend on a compiler, we could easily cobble together a solution to join each part in our build process. Like I said, I know I can create a step to join them before passing to Svelte, but I'd like to avoid joining something only to be splitted after if possible.

Thanks and congratulations for the excellent work!

@thedaniel
Copy link

Seems like @Rich-Harris answered your question in this comment: #65 (comment)

.. so this issue is probably a dupe of #65, though it could use a better name

@Rich-Harris
Copy link
Member

I've changed the title of #65 to the title above, since it's a lot more descriptive – will close this in favour of that

@EsmeraldiBejolli
Copy link

hi @rhengles please can you share with us the way how you menage to join separated js and html file together before passed them on Svelte

@Conduitry
Copy link
Member

I created a Rollup plugin a little while back that handles this (though not in a way that produces nice sourcemaps) - https://github.com/Conduitry/rollup-plugin-svelte-combiner

@rhengles
Copy link
Author

hi @EsmeraldiBejolli ! Actually I didn't create a solution to join files in Svelte, only in my Vue apps :)

In Vue it is not such a big disadvantage because it doesn't separate them again. In Vue, I don't have to create temporary Single File Components - I create components directly from the javascript and only inject the html files into the 'template' property.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants