Nuxt module for rewriting your routes with suffix.
Just for fun!
-
Automatically append suffix to every route's path
-
Redirect origin path and aliases to the suffixed path
Install the module to your Nuxt application with one command:
npx nuxi module add @zinkawaii/nuxt-rewrite
That's it! You can now use nuxt-rewrite in your Nuxt app ✨
export default defineNuxtConfig({
modules: ["@zinkawaii/nuxt-rewrite"],
rewrite: {
/* rewrite options */
}
});
suffix
: An arbitrary string, like "php".
If you want definePageMeta
to take effect, please add the following option in nuxt.config.ts
:
export default defineNuxtConfig({
experimental: {
scanPageMeta: true
}
});
experimental.typedPages
also has the same effect, but it has other uses.
When manually configuring routes using app/router.options.ts
, it is necessary to use it to set the suffix.
// app/router.options.ts
export default defineRewriteRouter({
suffix: "php",
routes: [
/* some routes */
]
});
# Install dependencies
npm install
# Generate type stubs
npm run dev:prepare
# Develop with the playground
npm run dev
# Build the playground
npm run dev:build
# Run ESLint
npm run lint
# Run Vitest
npm run test
npm run test:watch
# Release new version
npm run release