More Premium Hugo Themes Premium Nuxt Themes

Nuxt Precompress

Nuxt module for gzip and Brotli auto compress and serve

Nuxt Precompress

Nuxt module for gzip and Brotli auto compress and serve

Author Avatar Theme by frenchrabbit
Github Stars Github Stars: 120
Last Commit Last Commit: May 6, 2021 -
First Commit Created: Dec 18, 2023 -
Nuxt Precompress screenshot

Overview:

The Precompress files to gzip and brotli feature automatically compresses files to gzip and brotli formats at build-time in order to improve the performance of a Nuxt application. The module uses the compression-webpack-plugin for gzip and brotli compression.

Features:

  • Precompress files: Compresses files to gzip and brotli formats at build-time.
  • Automatic serving: Serves the compressed files if the browser supports gzip and brotli compression.
  • Node.js version compatibility: Supports brotli compression only in Node.js version 11.7.0 and above. For lower versions, it will only generate gzip versions.

Installation:

To install the Precompress files to gzip and brotli module, follow these steps:

  1. Add the module to your Nuxt project’s modules section in the nuxt.config.js file.
  2. If needed, set custom options for the module. The default options will be used if not specified.
// nuxt.config.js

module.exports = {
  // ...
  modules: [
    // ...
    'precompress',
    // ...
  ],
  // Optional: Customize module options
  precompress: {
    // Specify custom options here
  },
  // ...
}

Summary:

The Precompress files to gzip and brotli module is a useful tool for improving the performance of a Nuxt application. It automatically compresses files to gzip and brotli formats at build-time and serves them if the browser supports the respective compression formats. It uses the compression-webpack-plugin for gzip and brotli compression, with native support for brotli added in Node.js version 11.7.0. The module can be easily installed and customized according to specific project requirements.