-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Closed
Labels
feature / enhancementNew feature or requestNew feature or requestp2-nice-to-haveSvelteKit cannot be used by a small number of people, quality of life improvements, etc.SvelteKit cannot be used by a small number of people, quality of life improvements, etc.
Description
Describe the problem
The following directory layout creates an endpoint for post.spec.js and post.md, and the only way to opt out is to make them private modules with an underscore/dot prefix:
src
└── routes
└── posts
├── post.md 👈 converted to endpoint!
├── post.spec.js 👈 converted to endpoint!
└── post.svelte
Some developers might require the exact layout/naming shown, where:
- The files are colocated
- The files have the same basename
Describe the proposed solution
Add a configuration option that excludes files.
For example, a kit.excludes config could accept an array of String, RegExp, or Function.
String- The basename of the file/directory is compared against the string, and it's excluded if matches.RegExp- The basename of the file/directory is tested against the regular expression, and it's excluded if matches.({ filepath, basename }) => boolean- The file/directory is excluded if the function returnstrue.
The default would be [^_.] to match the current behavior. This also would enable users to override the current behavior, allowing for underscore/dot-prefixed files to be included in routing.
Alternatives considered
- Use underscore/dot prefix to make the files private modules - Defeats requirement 1
- Store the files outside of
src/routes- Defeats requirement 2
Importance
nice to have
Additional Information
No response
hyunbinseo and d4rekanguok
Metadata
Metadata
Assignees
Labels
feature / enhancementNew feature or requestNew feature or requestp2-nice-to-haveSvelteKit cannot be used by a small number of people, quality of life improvements, etc.SvelteKit cannot be used by a small number of people, quality of life improvements, etc.