A media viewer for public assets in Nuxt.js
- Preview assets with their meta data
- Generate snippets for responsive/retina images
- Generate and customize inline SVG from your assets
- Add
@cssninja/nuxt-media-viewer
dependency to your project
# Using pnpm
pnpm add -D @cssninja/nuxt-media-viewer
# Using yarn
pnpm add -D @cssninja/nuxt-media-viewer
# Using npm
npm install --save-dev @cssninja/nuxt-media-viewer
- Add
@cssninja/nuxt-media-viewer
to themodules
section ofnuxt.config.js
export default defineNuxtConfig({
modules: [
'@nuxt/devtools',
'@cssninja/nuxt-media-viewer'
]
})
- Go to the media viewer page and start previewing your assets at http://localhost:3000/__media_viewer/client/ or open the devtools and click on the
Media Viewer
tab.
type ModuleOptions = {
/**
* @default false
*/
installIpxMiddleware?: boolean
/**
* @default '/_ipx'
*/
ipxMiddlewarePrefix?: string
}
export default defineNuxtConfig({
modules: [
'@cssninja/nuxt-media-viewer'
],
mediaViewer: {
installIpxMiddleware: false,
ipxMiddlewarePrefix: '/_ipx',
}
})
- Run
npm run dev
to develop the client UI. - Use
npm run dev:playground
to start playground in development mode.