spatie / laravel-mix-purgecss

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

PurgeCss on mutiple css files #79

Closed ebrahimirad closed 4 years ago

ebrahimirad commented 5 years ago

Hi dear friends, I have multiple SCSS files for different pages but final PurgeCss command apply on all css files. Please help me, thanks

`mix.sass('resources/assets/sass/app.scss', 'public/build/css').options({ processCssUrls: false }).purgeCss({ enabled: true, whitelistPatterns: whitelistPatterns }).version();

mix.sass('resources/assets/sass/app-home.scss', 'public/build/css').options({ processCssUrls: false }).purgeCss({ enabled: true, paths: () => glob.sync([ path.join(dirname, 'resources/views/layouts/app.blade.php'), path.join(dirname, 'resources/views/layouts/flushMessage.blade.php'), path.join(dirname, 'resources/views/layouts/appHeader.blade.php'), path.join(dirname, 'resources/views/layouts/appFooter.blade.php'), path.join(dirname, 'resources/views/layouts/callNumber.blade.php'), path.join(dirname, 'resources/views/home.blade.php'), path.join(__dirname, 'resources/views/home/*.blade.php'), ]), whitelistPatterns: whitelistPatterns }).version();

mix.sass('resources/assets/sass/app-teacher-list.scss', 'public/build/css').options({ processCssUrls: false }).purgeCss({ enabled: true, paths: () => glob.sync([ path.join(dirname, 'resources/views/layouts/app.blade.php'), path.join(dirname, 'resources/views/layouts/flushMessage.blade.php'), path.join(dirname, 'resources/views/layouts/appHeader.blade.php'), path.join(dirname, 'resources/views/layouts/appFooter.blade.php'), path.join(dirname, 'resources/views/layouts/callNumber.blade.php'), path.join(dirname, 'resources/views/teacherList.blade.php'), ]), whitelistPatterns: whitelistPatterns }).version();`

ivandokov commented 4 years ago

This is indeed an issue. The most common use case is admin panel + public facing apps in a single Laravel app. They could have completely separate assets.

divdax commented 4 years ago

Would love to see this too. i use separate css for admin and frontend.

spatie-bot commented 4 years ago

Dear contributor,

because this issue seems to be inactive for quite some time now, I've automatically closed it. If you feel this issue deserves some attention from my human colleagues feel free to reopen it.

ivandokov commented 4 years ago

I think the case is still relevant and it deserves attention.

rdpascua commented 4 years ago

I'm having the same issue

danielbachhuber commented 4 years ago

This approach did the trick for me: https://github.com/spatie/laravel-mix-purgecss/issues/73#issuecomment-523490163