Laravel - Compiling Assets - Postcss

PostCSS, a powerful tool for transforming your CSS, is included with Laravel Mix out of the box. By default, Mix leverages the popular Autoprefixer plugin to automatically apply all necessary CSS3 vendor prefixes. However, you're free to add any additional plugins that are appropriate for your application.

First, install the desired plugin through NPM and include it in your array of plugins when calling Mix's postCss method. The postCss method accepts the path to your CSS file as its first argument and the directory where the compiled file should be placed as its second argument:

    
    mix.postCss('resources/css/app.css', 'public/css', [
        require('postcss-custom-properties')
    ]);
	

Or, you may execute postCss with no additional plugins in order to achieve simple CSS compilation and minification:

    
    mix.postCss('resources/css/app.css', 'public/css');