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.

Scan files with .css extension

See original GitHub issue

Love this package, thanks so much! This is a different question from #67 (I am sending my css through postCSS, and I’m trying to not purge certain classes).

Maybe I’m missing something, but is there a way to scan for classes defined in my own .css files? Very minimal reproduction of my setup:

// webpack.mix.js

mix.postCss('resources/css/app.css', 'public/css', [
    require('postcss-import'),
    require('tailwindcss'),
])

if (mix.inProduction()) {
    mix.purgeCss({
        extensions: ['html', 'js', 'php', 'vue', 'css']
    })
}
/* resources/css/app.css */
@import 'custom';
/* resources/css/custom.css */
.special-snowflake-class {
    @apply .block .bg-blue-500;
    height: 42px;
}

I would have thought that because I listed css in the extensions to scan, any of my own classes in my css files would be included, that’s not happening. I need .special-snowflake-class included in my build even if it doesn’t appear anywhere else in my project besides where it’s defined in custom.css. Is that possible?

Thanks!

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:11 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
sebastiandedeynecommented, Oct 14, 2019

Iirc mix.styles only concatenates css files, it doesn’t do any processing. You’ll need to use mix.postCss instead.

0reactions
btumblesoncommented, Oct 15, 2019

@bakerkretzmar Surprisingly painless and disappointed I didn’t figure that out myself. Thanks for pointing me in the right direction. In case anyone else lands here, Baker has the right approach from his comment:

mix.js('resources/assets/js/app.js', 'public/js')
    .options({
        processCssUrls: false,
        postCss: [
            require('postcss-import'),
        ]
    });

mix.postCss('resources/assets/css/client/combined.css','public/css/client-app.css')
    .purgeCss();
Read more comments on GitHub >

github_iconTop Results From Across the Web

CSS Scan - The fastest and easiest way to check, copy and ...
The smartest browser extension for CSS inspection. No unuseful, duplicated, overridden, or longhand CSS. CSS Scan runs hundreds of real-time advanced ...
Read more >
CSS Scan
The fastest and easiest way to check, copy and edit CSS. This extension is paid and requires a license to use it. You...
Read more >
CSS Scan Pro
A re-imagined Devtools for web design · Built to work on any website · Powerful, accurate and lightspeed CSS inspection · See an...
Read more >
Use CSS Scan To Easily Find All CSS For Any Element On ...
CSS Scan is a powerful browser extension that will help you uncover the CSS needed for any CSS styling on any website. You'll...
Read more >
6 Awesome CSS Extensions for VS Code - DigitalOcean
Supports Zen Coding completion for class and id attributes. Scans workspace folder for css and scss files. Supports remote css files.
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