spatie / laravel-mix-purgecss

Zero-config Purgecss for Laravel Mix
https://spatie.be/en/opensource
MIT License
874 stars 38 forks source link

Laravel Mix 6 Support #89

Closed HDVinnie closed 3 years ago

HDVinnie commented 4 years ago

See https://github.com/JeffreyWay/laravel-mix/issues/2527#issuecomment-705226406

sebastiandedeyne commented 4 years ago

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 (https://github.com/FullHuman/purgecss/issues/488). I think we'll be able to tag a new version when that's done.

sebastiandedeyne commented 4 years ago

Continuing this in #90.

kingroho commented 4 years ago

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.

sebastiandedeyne commented 4 years ago

Could you share:

mwargan commented 3 years ago

+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,
   });
sebastiandedeyne commented 3 years ago

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.

sebastiandedeyne commented 3 years ago

Shipped! 🚢