I'm implementing a mini CSS library using SASS and I want to purge it, currently I'm using purgecss and I don't have any problems with it, but one problem is when I add a class from the CSS library to my html, the A specific class will not be included in my purge file, I need to re-purge my CSS library CSS file to include that specific class, but I need purgecss to monitor my CSS file and add the class when adding it to my project, And I don't need to clear the CSS file again, any ideas?
To dynamically include classes from a CSS library without having to manually re-purge the CSS files, you can use PurgeCSS with PurgeCSS's additional configuration file to monitor CSS files and include specific classes.
The setting method is as follows:
purgecss.config.js
. This file will specify the files to clean and any other configuration options.Make sure to adjust the paths and filenames in the snippet above to match your project structure. Additionally, if you use a different build system or tool, you may need to adjust your configuration accordingly.
With this setting, you don't need to manually re-clear the CSS files every time you add a class from the CSS library to your project. Instead, PurgeCSS will monitor changes and dynamically include these classes during the build process.