JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 878
  • Score
    100M100P100Q126722F
  • License MIT

A Vite plugin that integrates PurgeCSS with Laravel template assets.

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

Get package from npm Downloads Downloads

A Vite plugin that integrates PurgeCSS with Laravel 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 @erbelion/vite-plugin-laravel-purgecss --dev

npm

npm i @erbelion/vite-plugin-laravel-purgecss --save-dev

Usage

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(s) to be processed
blade resources/views/**/*.blade.php
svelte resources/views/**/*.svelte
resources/js/**/*.svelte
vue resources/views/**/*.vue
resources/js/**/*.vue
react resources/views/**/*.tsx
resources/views/**/*.ts
resources/views/**/*.jsx
resources/views/**/*.js
resources/views/**/*.html
resources/js/**/*.tsx
resources/js/**/*.ts
resources/js/**/*.jsx
resources/js/**/*.js
resources/js/**/*.html
angular resources/views/**/*.html
resources/js/**/*.html

You may also provide custom paths via paths option.