question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

how to use purgeCss with mix.combine ?

See original GitHub issue

Just read https://murze.be/reducing-the-size-of-a-css-file

Which led me to a new package called purgeCss which is supposed to be a big improvement on purefyCss and can shrink your css files to a tiny size in some cases as described in the article above

Package page: https://github.com/FullHuman/purgecss

this led me to this laravel mix base template: https://gist.github.com/reinink/83058f9af402aa474010844f7f2b1c54

Now the above example works on a single app.css. But in my case I would like to apply purgeCss on a bunch of different files that are being combined through mix.combine like so:

mix.combine([
    'resources/assets/css/bootstrap-modals-override.css',
    'resources/assets/css/my.animations.css',
    'resources/assets/css/my.containers.css',
    'resources/assets/css/my.core.css',
    'resources/assets/css/my.footer.css',
    'resources/assets/css/my.forms.css',
    'resources/assets/css/my.header.css',
    'resources/assets/css/my.menu.css',
    'resources/assets/css/my.plugins.css',
    'resources/assets/css/my.responsive.css',
], 'public/dist/css/general.css');

I’ve installed all the dependencies and am setting the plugins like in the template above. But it is having no effect on my combined css files such as general.css above

Would appreciate some help!

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
vesper8commented, Nov 27, 2017

yea I figured you can run the CLI command after the result of combine()

What I ended up doing is just got rid of my use of combine() and made a file with a bunch of @import instead so I don’t have to use .combine(). I was then able to use postCss()

0reactions
laracastscommented, Dec 4, 2017

You can purge CSS with mix.combine(). That command is separate from your webpack build. All it does is combine/concatenate files.

Read more comments on GitHub >

github_iconTop Results From Across the Web

how to use purgeCss with mix.combine ? · Issue #1335 - GitHub
But in my case I would like to apply purgeCss on a bunch of different files that are being combined through mix.combine like...
Read more >
How to use PurgeCSS with Laravel Mix in a Craft CMS Project.
Here is how I did it using Laravel Mix, first you need to add the NPM package. Add the npm package. BASH. yarn...
Read more >
Cleaning unused CSS with Purgecss and Laravel Mix
First lets look at the processes already in place and the filesize being output. As this is a Laravel app it makes sense...
Read more >
Compiling multiple CSS into ONE CSS with Laravel MIX
The solution was to import all the required css into one main css file, then use that inside the mix chain: app.css:
Read more >
Purgecss | Laravel Mix Extension
PurgeCSS can be enabled by calling .purgeCss() in your Mix chain. mix.js('resources/js/app.js' ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found