Minify the html for each request served by nuxt server (nuxt start
)
ℹ️
nuxt generate
already has built-in support for minifying html
🔥 Using this module could be a performance hit 🔥 it is recommended to only use it when you have a caching proxy in front of your Nuxt server (at least until we have benchmarks to determine the real world impact)
yarn add @nuxtjs/html-minifier
OR npm i @nuxtjs/html-minifier
Add @nuxtjs/html-minifier
to modules
section of nuxt.config.js
{
modules: [
['@nuxtjs/html-minifier', { log: 'once', logHtml: true }]
]
}
- Default:
true
If false
then every url which generated an error wont be minified in future requests
-
Default:
always
-
always
: always log html-minifier errors -
once
: only log html-minifier errors once for each url -
false
: never log html-minifier errors
- Default:
false
Be wary to enable this in production, your disk could fill up quickly!
If true
then the html which failed to minimize is also logged
This module uses the build.html.minify
property for configuring html minifier
- Clone this repository
- Install dependencies using
yarn install
ornpm install
- Start development server using
npm run dev
Copyright (c) Nuxt Community.