Skip to content

Nuxt module for rewriting your routes with suffix.

Notifications You must be signed in to change notification settings

KazariEX/nuxt-rewrite

Repository files navigation

Nuxt Rewrite

npm version npm downloads License Nuxt

Nuxt module for rewriting your routes with suffix.

Just for fun!

Features

  • Automatically append suffix to every route's path

  • Redirect origin path and aliases to the suffixed path

Quick Setup

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 ✨

Options

export default defineNuxtConfig({
  modules: ["@zinkawaii/nuxt-rewrite"],
  rewrite: {
    /* rewrite options */
  }
});
  • suffix: An arbitrary string, like "php".

Tips

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.

Utils

defineRewriteRouter

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 */
  ]
});

Contribution

# 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

About

Nuxt module for rewriting your routes with suffix.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published