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

Add ability to ignore files #15

Closed
kentcdodds opened this issue Sep 14, 2022 · 5 comments
Closed

Add ability to ignore files #15

kentcdodds opened this issue Sep 14, 2022 · 5 comments

Comments

@kentcdodds
Copy link

kentcdodds commented Sep 14, 2022

I'd like to colocate .css and .test.tsx files with my files in my routes. So I'd like to be able to ignore files as routes. Something like this config?

module.exports = {
	ignoredRouteFiles: ['**/*'],
	routes: async defineRoutes => {
		return flatRoutes('routes', defineRoutes, {
			ignoredRouteFiles: ['**/.*', '**/*.css', '**/*.test.{js,jsx,ts,tsx}'],
		})
	},
}
@kiliman
Copy link
Owner

kiliman commented Sep 14, 2022

Are you using flat-files or flat-folders? With folders, it's a non-issue, but with flat-files, I can see why you'd want that option.

Anyway, I will add that option. Sorry it was an oversight.

@kentcdodds
Copy link
Author

After having read the docs, I see that the folder solution is the intended solution to this kind of colocation which is great 👍 I do think having the option would be good still.

Also, I just saw a reference to routeIgnorePatterns in the docs. What is that?

@kiliman
Copy link
Owner

kiliman commented Sep 14, 2022

Also, I just saw a reference to routeIgnorePatterns in the docs. What is that?

Ah, I just copy+pasted from Ryan's gist. I believe he meant ignoredRouteFiles. And his commentary was mainly saying how it was difficult to tell which were route files and which weren't without referring to the config. With flat-folders, you know that anything other than index (or the various aliases like _route, _layout etc.) were supporting files.

I'm almost finished with the update. Just writing my tests.

@kiliman
Copy link
Owner

kiliman commented Sep 14, 2022

Published as v0.4.4

@kentcdodds
Copy link
Author

Thank you very much!

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

2 participants