Hello everyone !
I wanted to share you a little tip with nuxt generate.
I wanted to put my landing pages in a CDN but not my dashboard.
According to the nuxt generate documentation we you can use exclude with a regex.
But yeah "regex".
I don't like (a lot!) regex and i prefer to use include instead of using exclude.
I created a module that use 'generate:extendRoutes' and introduce whitelist instead of exclude.
// modules/custom-generate.js
module.exports = function() {
this.nuxt.hook('generate:extendRoutes', (routes) => {
const whiteList = [
'/', //this is the index.vue root file
'/talents-signed-up',
'/404',
'/company-signed-up',
'/company',
'/talents'
]
const routesToGenerate = routes.filter((page) => {
return whiteList.includes(page.route)
})
routes.splice(0, routes.length, ...routesToGenerate)
})
}
This module is ok if you don't have a lot of pages that you want to generate.
You can add 'regex' valiation in the filter instead of my array if you prefer :).
Thank's !