Closed mrgnw closed 4 years ago
Unfortunately, the preprocessor itself can't really manage this. The preprocessor is called for a given file, it does not detect those files itself. This behaviour would need to integrated into the platform that calls the preprocessor in the first place.
In the case of Sapper, it would not work sadly, as sapper generates a list of routes and the corresponding components for each route, before anything happens. There is no way to hook into this step, to 'skip' certain files/ routes, as it stands. It may be possible for a plugin to hijack the filesystem to 'hide' certain files from Sapper when it is generating this route manifest but outside of that extreme approach, I'm not sure there is a way to achieve this.
Because of that, this is something that needs to integrated at the level above mdsvex and can't be handled by the preprocessor istelf.
Good to know. Thanks for explaining!
Just to clarify, this higher level tooling is something I hope to look into when I've cleared the mdsvex
backlog, I don't think Sapper is the right tool for a static site generator, there are a few issues and limitations that come with simply using the nextjs style export
approach that sapper provides.
Would it be feasible to implement a
published
boolean to manage file visibility?It's a convention I noticed dev.to uses: dev.to/new
This way we can safely check files in without publishing. Of course this means they would be visible in the repo, just not on the site.
I think this could be independent of routing thanks to preprocess. Maybe
published
could be a way to effectively skip files during preprocess.This is still a bit conceptual but I wanted to at least put it out there in case it's feasible. :)