Skip to content

Latest commit

 

History

History
56 lines (41 loc) · 1 KB

README.md

File metadata and controls

56 lines (41 loc) · 1 KB

nuxt-slugify

Easy way to integrate Slugify with Nuxt 3

Setup

  1. Add nuxt-slugify dependency to your project
npm i -D nuxt-slugify
  1. Add nuxt-slugify to the modules section of nuxt.config.ts.

Usage

You can use the slugify method with the injected function or with the composable:

<template>
	<div>
		{{ $slugify('Hello world @ Slugify! 🐱') }}
	</div>
</template>

<script setup lang="ts">
const slugify = useSlugify()

onMounted(() => {
	console.log(slugify('Hello world @ Slugify! 🐱'))
})
</script>

Options

export default defineNuxtConfig({
    modules: ['nuxt-slugify'],
    slugify: {
        defaults: {
            // global settings
        },
        extend: {
            // extend support
        },
    }
})

More information in the Slugify repository

Development

  • Run npm run dev:prepare to generate type stubs.
  • Use npm run dev to start playground in development mode.