awcodes / filament-plugin-purge

A purge tool to keep your Filament plugin from bloating / duplicating Filament's default styles.
MIT License
9 stars 2 forks source link

Purge excludes classes #4

Closed mansoorkhan96 closed 9 months ago

mansoorkhan96 commented 9 months ago

Purge commands removes certain classes. I have a div with classes grid grid-cols-2 gap-4 sm:grid-cols-4 and when hit purge command sm:grid-cols-4 classe is not there same goes for a few more classes. However other classes being included.

/*resources/css/filament-custom.css*/

@config "../../tailwind.filament-custom.config.js";

@tailwind components;
@tailwind utilities;

@layer components {
    .gd-light{
        background: repeating-linear-gradient(-45deg, whitesmoke, whitesmoke 0.5em, #e8e8e8 0.5em, #e8e8e8 1em);
    }

    .gd-dark {
        background: repeating-linear-gradient(-45deg, #303030, #303030 0.5em, #3c3c3c 0.5em, #3c3c3c 1em);
    }
}

.custom-gd {
    @apply gd-light cursor-not-allowed gd-dark;
}
// tailwind.filament-custom.config.js

import preset from './vendor/filament/support/tailwind.config.preset'

export default {
    presets: [preset],
    content: [
        // './vendor/filament/**/*.blade.php',
       './resources/views/filament/pages/custom.blade.php',
    ],
}
// package.json

"scripts": {
        "build-filament-custom-css": "npx tailwindcss -i resources/css/filament-custom.css -o resources/dist/css/filament-custom.css --minify",
        "purge-filament-custom-css": "npm run build-filament-custom-css && filament-purge -i resources/dist/css/filament-custom.css -o resources/dist/css/filament-custom.css"
    },

NOTE: Its not package, Its inside a normal Laravel app.

awcodes commented 9 months ago

You shouldn't be using this inside a normal app. It's meant for packages to keep from duplicating classes that are already in filament.

mansoorkhan96 commented 9 months ago

You shouldn't be using this inside a normal app. It's meant for packages to keep from duplicating classes that are already in filament.

Ok, time to extract it to a plugin then.

Thanks for working on this package @awcodes ♥️

awcodes commented 9 months ago

If the views are in your app then they would be covered by a custom theme, so you wouldn't need this plugin. :)