PurgeCSS config and disabled html elements

How to configure PostCSS/PurgeCSS with hugo to save classes for disabled elements?

html code example: <a href="..." disabled>

postcss.config.js:

const purgecss = require('@fullhuman/postcss-purgecss')({
    content: [ './hugo_stats.json' ],
    defaultExtractor: (content) => {
        let els = JSON.parse(content).htmlElements;
        return els.tags.concat(els.classes, els.ids);
    }
});

module.exports = {
     plugins: [
        ...( [ purgecss ] )
     ]
 };

config.yaml:

build:
  # Used by PurgeCSS
  writeStats: true

In my case all [disabled] classes (like a[disabled]) are removed after PurgeCSS.

How to fix it?

AFAIK, PurgeCSS allows you to define a white list of selectors for those elements that should not be removed. Something like a[disabled] might work.

In any case, you should check the documentation for PurgeCSS as this has nothing to do with Hugo per se.