Nuxt HTTP Client Hints Module
![Nuxt](https://img.shields.io/badge/Nuxt-020420?logo=nuxt.js)
Access and use HTTP Client Hints in your Nuxt application. Detect the client browser and the operating system on your server.
Features
HTTP Client hints
[!WARNING]
The HTTP Client hints headers listed below are still in draft and only Chromium based browsers support them: Chrome, Edge, Chromium and Opera.
The module includes support for the following HTTP Client hints:
Quick Setup
Install the module to your Nuxt application with one command:
npx nuxi module add nuxt-http-client-hints
Add your configuration to your Nuxt config file:
httpClientHints: {
}
Add your client and server plugins to your Nuxt application and register the corresponding hooks with your configuration:
export default defineNuxtPlugin((nuxtApp) => {
nuxtApp.hook('http-client-hints:client-hints', (httpClientHints) => {
})
})
export default defineNuxtPlugin((nuxtApp) => {
nuxtApp.hook('http-client-hints:ssr-client-hints', (httpClientHints) => {
})
})
You use the httpClientHints object in your application to access the configuration:
<template>
<pre>{{ $httpClientHints }}"</pre>
</template>
or in your modules, composables, or other plugins:
const clientHints = useNuxtApp().$httpClientHints
That's it! You can now use HTTP Client Hints in your Nuxt app ✨
You can check the source code or the JSDocs for more information.
Contribution
Local development
pnpm install
pnpm run dev:prepare
pnpm run dev
pnpm run dev:build
pnpm run lint
pnpm run test
pnpm run test:watch
License
MIT License © 2024-PRESENT Joaquín Sánchez