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.

Purgecss not working in my Laravel App

See original GitHub issue

I am working on a project where I am using separate assets for frontend and backend.

I am trying to use purge css for frontend with specific folders and views. I don’t think it’s working. Can someone look into my configuration and tell me what to do?

image

mix.scripts([
    'public/website/js/jquery-3.4.1.min.js',
    'public/website/js/popper.min.js',
    'public/website/js/bootstrap.min.js',
    'public/website/js/slick.min.js',
    'public/website/js/modernizr-webp.js',
    'public/website/js/main.js',
    'public/website/js/jssocials.min.js',
], 'public/website/js/script.js');

mix.styles([
    'public/website/css/fontawesome.min.css',
    'public/website/css/bootstrap.min.css',
    'public/website/css/slick.css',
    'public/website/css/slick-theme.css',
    'public/website/css/jssocials.css',
    'public/website/css/jssocials-theme-flat.css',
    'public/website/css/style.css',
], 'public/website/css/main.css').purgeCss({
    enabled: true,
    paths: () => glob.sync([
        path.join(__dirname, 'resources/views/website/**/*.blade.php'),
        path.join(__dirname, 'resources/views/website/*.blade.php'),
        path.join(__dirname, 'resources/views/includes/website.blade.php'),
        path.join(__dirname, 'resources/views/auth/**/*.blade.php'),
        path.join(__dirname, 'resources/views/auth/*.blade.php'),
        path.join(__dirname, 'public/website/js/script.js'),
    ]),
});

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:15 (1 by maintainers)

github_iconTop GitHub Comments

4reactions
aurawindsurfingcommented, Feb 27, 2020

Reverting back to 4.1.0 did the trick. Latest one didi not work on fresh laravel install with tailwind

4reactions
jeytiicommented, Feb 25, 2020

@avvertix The newest version actually does work. You just have to add the enabled: true option.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Laravel Mix and PurgeCss chain, not purging specified file ...
Trying to build out specific purgedCSS files for a project with rather large complete CSS file. However PurgeCSS refuses to only purge the...
Read more >
Purgecss | Laravel Mix Extension
This package adds a purgeCss option to Laravel Mix, which installs PurgeCSS for you with a set of sensible defaults for Laravel applications....
Read more >
Cleaning unused CSS with Purgecss and Laravel Mix
The site I'd been working on is written in Laravel and as it didn't have a backend it was a great candidate for...
Read more >
How to use PurgeCSS with Laravel Mix in a Craft CMS Project.
PurgeCSS is a a package that you can use to strip out unused CSS from your stylesheet, greatly reducing the file size when...
Read more >
Laravel 8 + Tailwind PurgeCSS - Laracasts
When I run npm run production I expect that the app.css file to be purged of extra tailwind classes, but the resulting file...
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