Overview
The Nuxt PurgeCSS is a tool that enables you to remove unnecessary CSS from your project. It is designed to be used with Nuxt 2 and Nuxt 3 and offers a simple setup process. With default settings and support for customization, the module makes it easy to optimize your project’s CSS.
Features
- Remove unneeded CSS with ease: The Nuxt PurgeCSS allows you to easily remove CSS that is not used in your project, reducing the file size and improving performance.
- Sane default settings: The module comes with default settings that scan your .vue, .js, and .ts files in common Nuxt folders. It also whitelists typical classes used for transitions, nuxt links, and scoped styles.
- Built on top of PurgeCSS: The Nuxt PurgeCSS is built on top of PurgeCSS, a popular tool for removing unused CSS. This ensures that you benefit from the functionality and performance optimizations of PurgeCSS.
- Nuxt 2 and Nuxt 3 support: The module supports both Nuxt 2 and Nuxt 3 versions, allowing you to use it with your preferred version of Nuxt.
- Fully tested: The Nuxt PurgeCSS module has been thoroughly tested to ensure its reliability and compatibility with different Nuxt setups.
Installation
To install the Nuxt PurgeCSS module, follow these steps:
Add the
nuxt-purgecssdependency to your project by running the following command:npm install nuxt-purgecssOnce the dependency is installed, add
nuxt-purgecssto the modules section of yournuxt.config.jsornuxt.config.tsfile:export default { modules: [ 'nuxt-purgecss', ], // ... }
Note: If you are using Nuxt 2, please use version 1 of the module.
Summary
The Nuxt PurgeCSS module is a useful tool for optimizing your project’s CSS by removing unused styles. It comes with easy setup and customization options, making it convenient to use with Nuxt 2 and Nuxt 3. With its ability to remove unneeded CSS and its integration with PurgeCSS, the Nuxt PurgeCSS module helps improve the performance and load times of your Nuxt projects.