purgecss is a tool for removing unused css classes from source files. It's particularly useful for functional css frameworks like tachyons, where it's normal to only use a tiny fraction of available classes. This gist contains example code you could use to add purgecss to a shadow-cljs build.
- make sure to
yarn add purgecss
first
- usage is
(hooks/purge-css {:css-source __ :js-globs __ :out-dir __})
:css-source
is the path to the original, bloated CSS file (from project root). This is ideally in a source directory, or node_modules
as in this example. This cannot be the public path where the css is ultimately read.
:js-globs
is a string / vector of strings, indicating which files to read as input. These should be all of your compiled javascript bundles which contain your views. purgecss
does a brute-force parse of all these files, extracting all the strings to figure out which clas