Advanced Usage

Purge CSS

Table of Contents

{note} You're browsing the documentation for an old version of laravel-form-components. Consider upgrading your project to v8. Check your version with the following command:

composer show rawilk/laravel-form-components

Purge CSS is useful for trimming out unused styles from your stylesheets to reduce your overall build size. To ensure the class styles from this package don't get purged from your production build, you should add the following to your purge css content configuration:

{note} The following code snippet is for a TailwindCSS build configuration using a tailwind.config.js file in the build.

module.exports = {
    // ...
    purge: {
        content: [
            // Typical laravel app purge css content
            './app/**/*.php',
            './resources/**/*.php',
            './resources/**/*.js',
            
            // Make sure you add these lines
            './vendor/rawilk/laravel-form-components/src/**/*.php',
            './vendor/rawilk/laravel-form-components/resources/**/*.php',
        ],
    },
};

If some styles are still being purged, it may be useful to wrap the import statement of the package's stylesheet in a /* purgecss start ignore */:

/* purgecss start ignore */
@import "../../vendor/rawilk/laravel-form-components/resources/sass/form-components";
/* purgecss end ignore */

{tip} Please refer to styling for more information.

Previous
FilePond
Caught a mistake? Suggest an edit on GitHub