Package Exports
- @erbelion/vite-plugin-laravel-purgecss
- @erbelion/vite-plugin-laravel-purgecss/dist/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@erbelion/vite-plugin-laravel-purgecss) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
vite-plugin-laravel-purgecss
A Vite plugin that integrates PurgeCSS with Laravel 10/9 template assets.
Apart from Blade, it also supports frontend frameworks such as Svelte, Vue, React and Angular. It works well with Inertia.
Installation
yarn
yarn add -D @erbelion/vite-plugin-laravel-purgecssnpm
npm i -D @erbelion/vite-plugin-laravel-purgecssUsage
Use plugin in your Vite config (vite.config.ts)
import purge from '@erbelion/vite-plugin-laravel-purgecss'
export default {
plugins: [
purge({
templates: ['blade']
})
]
}Options
| Parameter | Type | Description |
|---|---|---|
| templates? | string[] |
List of templates to be processed by PurgeCSS. See below. |
| paths? | string[] |
List of paths to be processed by PurgeCSS. |
| safelist? | UserDefinedSafelist |
Check available safelist options in PurgeCSS docs. |
Templates
| Parameter | Path to be processed |
|---|---|
| blade | resources/views/**/*.blade.php |
| svelte | resources/{js,views}/**/*.svelte |
| vue | resources/{js,views}/**/*.vue |
| react | resources/{js,views}/**/*.{tsx,ts,jsx,js,html} |
| angular | resources/{js,views}/**/*.html |
You may also provide custom paths via paths option.