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
How to exclude some routes when using nuxt generate #2719
Comments
you just create a page named |
Do you want only a subset of your pages generated when you run I was wanting to do the same thing today. My solution was to use a custom module to leverage the internal plugin system (Note that in the latest releases these are now called hooks and have been re-worked a bit. They don't appear to be documented yet.) I'm not sure if this is the best approach but it certainly seems to do the trick for now.
module.exports = function () {
this.nuxt.hook('generate:extendRoutes', async routes => {
const whiteList = ['/about', '/login'];
const routesToGenerate = routes.filter(page => whiteList.includes(page.route));
routes.splice(0, routes.length, ...routesToGenerate);
});
};
modules: [
'~modules/custom-generate.js'
], |
@qm3ster Good point. I think the only catch is that |
I tried but it did not work generate: {
routes: ["about"]
}, How to setting Nuxt Version : 1.3.0 |
@dan-peterson @SzHeJason I was wrong, this has been changed a gorillion months ago. |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
For all googlers, this is possible via regex in See #4754 |
current router
I just want to generate an
about
HTML file when usingnuxt generate
, how can I do that?The text was updated successfully, but these errors were encountered: