Closed cmizzi closed 6 years ago
What package versions are installed?
I've downgrade them because purgecss
was not applied on any file (#22)
├─ laravel-mix-purgecss@1.0.5
├─ laravel-mix@2.0.0
Did some digging in Mix's source code and I'm afraid we won't be able to support this.
The combine
function creates a new mix "task" that get run after Webpack, while Purgecss is a Webpack plugin.
I'd recommend not using combine at all, and import
ing those assets in your css/sass file directly.
Thank you @sebastiandedeyne.
Before I was using something like this:
mix
// ...
.styles([
'resources/assets/css/vendor/1.min.css',
'resources/assets/css/vendor/2.min.css'
], 'public/css/app.css')
.purgeCss()
;
And the app.css
was not purged at all. I thought it was not looking correctly for the blade/php/html files and tried adding config parameters with no luck.
After creating a sass/app.scss
file (and moving the fonts and images required by them):
@import "../css/vendor/1.min.css";
@import "../css/vendor/2.min.css";
I finally got it working:
mix
// ...
.sass('resources/assets/sass/app.scss', 'public/css')
.purgeCss()
;
It's unbelievable that the css file was reduced to less than the 3rd part of the original size and the app still looks the same. I will need to navigate between the sections before publishing.
I'm currently combined two CSS files (
font-awesome
with a custom CSS) butfont-awesome
selectors are not trimmedI think that the
combine
is called after thepurgecss
in the pipeline. Any suggestion ?