-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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 config.kit.files.routes
to be an array of directories
#6031
Comments
Using What about this as an alternative? The basic idea is that you start SvelteKit (dev or build) like so...
...and it creates a new Obviously I'm glossing over some details (e.g. you would probably want to watch the |
Thanks for the quick reply, @Rich-Harris! Indeed, it is hackery.
Yeah, that's the alternative I was considering (but with symlinks instead and not removing the project dir as it contains the override routes). Though, what are your thoughts on supporting multiple folders in |
I can see it being a potentially quite valuable addition. It would add some more moving parts though, and the aftershock of #5748 is still reverberating through the codebase — lots of small follow-up work that needs to happen — and so now would be a challenging time to make those sorts of changes. Once we ship 1.0 and have a more stable base work on top of I think we should revisit this. |
config.kit.routes
)config.kit.files.routes
to be an array of directories
@Rich-Harris Can this be re-visited now that it's post-1.0 😊 ? I have a similar use case, but nothing as exotic as having two projects - I'm generating a static site with |
I have a similar use case - I want to be able to share routes between multiple projects. For example, let's say I create a Blog package that I want to include in multiple projects with the minimum boilerplate/wiring-up possible (and ultimately to be able to share that package with the public). All the components and source files in $lib come over nicely, that's great. But the routes need to be re-created in some way for each project that uses the package. And while for a simple package like a Blog that isn't too much hassle, for something more complex like an e-commerce system, re-creating the routes - and dealing with updates to the shared packages - for each project becomes a problem. A solution like OP is describing would be incredibly helpful and I think would be a real boon for the Svelte ecosystem as we would be able to share share full functionality more easily and allow for more "batteries included" projects to be built on top of SvelteKit. |
I am migrating from express where I have a user module that handles all my user logic, routes, etc. and I just "plug in" to each project. I was looking for how to do this and stumbled on this thread. Being able to slice applications vertically and share them between projects. At present I can share the logic, and the lib components, but I have to recreate routes and pages which is a pain. |
I've a similar use case and such a possibility would be very helpful: I'm creating a backoffice application and as always there's a lot of similar screens in those that directly depend on the data model. I would like to be able to have two folders (e.g. Just found a workaround: put all generated routes in a (generated) group which serves only the purpose to have them under a single folder so its content can be ignored by git. Not ideal but seem to do the job for now. |
Is this by any chance implemented in SvelteKit 2.0? |
I don't think so, I'm using Svelte 2.4.3 and the |
Describe the problem
We have a multi-tenant SvelteKit project, with a directory structure like following:
Here, we've many common routes (index, about, terms). Each project can override the common routes with a few of their custom routes (like
project1
has its ownindex.svelte
but uses the commonabout.svelte
; andproject2
has a differentabout.svelte
but uses the common index and terms page.Before we had the new routing system (#5774), we could filter out specific files from routes directory to be considered for routing using the
config.kit.routes
function. This was done based on build-time env variables like following:Now, the
config.kit.routes
option has been removed and we can't upgrade to newer versions without major changes to our approach.Describe the proposed solution
config.kit.routes
option.config.kit.files.routes
, which can support overrides like above. This is arguably a niche use-case, but would love if this can be supported.Alternatives considered
We can create multiple top-level routes directories and symlink/hardlink the common routes to project-specific directory, while avoiding the existing non-symlink project-specific files, to have a directory structure like:
But this might cause confusion, where we update one file and it unexpectedly ends up updating other file too. Also, it will require us to delete the symlink and create a regular file when we want to override a route.
Importance
would make my life easier
Additional Information
No response
The text was updated successfully, but these errors were encountered: