Sebastian De Deyne over at Spatie is working on a package for . The package provides zero-config for your average Laravel :

let mix = require('laravel-mix');

// ...

mix.js('resources/assets/js/.js', 'public/js')
   .sass('resources/assets/sass/.scss', 'public/css')

All HTML, JS, PHP, and Vue files in the app and resource folders get scanned for selectors, and Purgecss is only enabled in production.

Most project shouldn’t need it, but if you need to go beyond the basics, you can configure Purgecss options and three options provided by the laravel-mix-purgecss package:

mix.js('resources/assets/js/app.js', 'public/js')
   .sass('resources/assets/sass/app.scss', 'public/css')
   .purgeCss({ /* My options */ });

Check the readme for more information on how to configure Purgecss and the additional custom options this package provides Laravel Mix.

If you are not familiar with Purgecss:

Purgecss is a tool to remove CSS. It can be used as part of your development workflow. Purgecss comes with a JavaScript API, a CLI, and plugins for popular build tools.

This package gives you Purgecss for free on your Laravel projects, so you can install it and benefit from smaller CSS files in production. Boom!

Check the package out at spatie/laravel-mix-purgecss on GitHub.

Source link


Please enter your comment!
Please enter your name here