# PurgeCSS config and disabled html elements

**URL:** <https://discourse.gohugo.io/t/purgecss-config-and-disabled-html-elements/38293>\
**Category:** support\
**Created:** [April 21, 2022, 5:05am UTC](https://discourse.gohugo.io/t/purgecss-config-and-disabled-html-elements/38293 "2022-04-21T05:05:35Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nick\_Knutov](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/nick_knutov/32/16125_2.png) [@Nick\_Knutov](https://discourse.gohugo.io/u/Nick_Knutov)\
**Post date:** [April 21, 2022, 5:05am UTC](https://discourse.gohugo.io/t/purgecss-config-and-disabled-html-elements/38293/1 "2022-04-21T05:05:35Z")

</div>

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

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

`postcss.config.js`:

```auto
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`:

```auto
build:
  # Used by PurgeCSS
  writeStats: true

```

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

How to fix it?

---

<div class="post-metadata">

**Author:** ![chrillek](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/chrillek/32/19797_2.png) [@chrillek](https://discourse.gohugo.io/u/chrillek)\
**Post date:** [April 21, 2022, 8:54am UTC](https://discourse.gohugo.io/t/purgecss-config-and-disabled-html-elements/38293/2 "2022-04-21T08:54:13Z")

</div>

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.
