spatie/laravel-mix-purgecss

Laravel Mix 6 Support

HDVinnie opened this issue ยท 7 comments

Working on this!

I just pushed a next branch with the progress. Laravel Mix updated to Postcss 8, but the Purgecss plugin doesn't support 8 yet (FullHuman/purgecss#488). I think we'll be able to tag a new version when that's done.

Continuing this in #90.

I still get TypeError: Cannot read property 'postCss' of undefined. I'm using laravel-mix 6.0.0-beta.11. Tried installing postcss and postcss-loader too. Still getting the same error.

Could you share:

  • The contents of webpack.mix.js
  • The output of npm list/yarn list

+1 with this issue on 6.

npm list outputs

โ”œโ”€โ”€ @babel/plugin-syntax-dynamic-import@7.8.3
โ”œโ”€โ”€ @babel/preset-env@7.12.7
โ”œโ”€โ”€ aos@3.0.0-beta.6
โ”œโ”€โ”€ axios@0.19.2
โ”œโ”€โ”€ bootstrap@4.5.3
โ”œโ”€โ”€ browser-sync-webpack-plugin@2.2.2
โ”œโ”€โ”€ browser-sync@2.26.13
โ”œโ”€โ”€ chart.js@2.9.4
โ”œโ”€โ”€ cross-env@5.2.1
โ”œโ”€โ”€ jquery@3.5.1
โ”œโ”€โ”€ laravel-echo@1.9.0
โ”œโ”€โ”€ laravel-mix-bundle-analyzer@1.0.5
โ”œโ”€โ”€ laravel-mix-purgecss@5.0.0
โ”œโ”€โ”€ laravel-mix-workbox@0.1.2
โ”œโ”€โ”€ laravel-mix@6.0.0-beta.15
โ”œโ”€โ”€ leaflet-geosearch@2.7.0
โ”œโ”€โ”€ leaflet@1.7.1
โ”œโ”€โ”€ moment@2.29.1
โ”œโ”€โ”€ popper.js@1.16.1
โ”œโ”€โ”€ postcss-loader@4.1.0
โ”œโ”€โ”€ postcss@8.2.0
โ”œโ”€โ”€ purify-css@1.2.5
โ”œโ”€โ”€ purifycss-webpack@0.7.0
โ”œโ”€โ”€ pusher-js@5.1.1
โ”œโ”€โ”€ resolve-url-loader@2.3.2
โ”œโ”€โ”€ sass-loader@7.3.1
โ”œโ”€โ”€ sass@1.30.0
โ”œโ”€โ”€ vue-chartjs@3.5.1
โ”œโ”€โ”€ vue-google-autocomplete@1.1.0
โ”œโ”€โ”€ vue-loader@15.9.5
โ”œโ”€โ”€ vue-stripe-elements-plus@0.3.2
โ”œโ”€โ”€ vue-template-compiler@2.6.12
โ”œโ”€โ”€ vue-textarea-autosize@1.1.1
โ”œโ”€โ”€ vue@2.6.12
โ”œโ”€โ”€ vue2-leaflet-geosearch@1.0.6
โ”œโ”€โ”€ vue2-leaflet-locatecontrol@1.0.1
โ”œโ”€โ”€ vue2-leaflet-markercluster@3.1.0
โ”œโ”€โ”€ vue2-leaflet@2.6.0
โ””โ”€โ”€ workbox-webpack-plugin@6.0.2

webpack.mix.js looks like

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

require('laravel-mix-purgecss');
require('laravel-mix-bundle-analyzer');

mix
.sourceMaps()
.js('resources/js/app.js', 'public/js')
.vue()
.extract([ 'vue', 'jquery', 'bootstrap', 'moment', 'pusher-js']);

mix.sass('resources/sass/app.scss', 'public/css')
.styles([
        'resources/sass/app.css',
    'resources/sass/normalize.css',
    'resources/sass/skeleton.css',
], 'public/css/all.css')
.purgeCss({
       enabled: true,
   });

I just tagged a beta version of laravel-mix-purgecss for testing.

Use version 6.0.0-beta.0 if you're using Laravel Mix 6, that should do the trick.

Shipped! ๐Ÿšข