Developmint / nuxt-purgecss

Drop superfluous CSS! A neat PurgeCSS wrapper for Nuxt.js
MIT License
478 stars 18 forks source link

purgeCSS ignores tailwind classes in nuxt.config.js (bodyAttr, htmlAttrs) #82

Closed MZanggl closed 4 years ago

MZanggl commented 4 years ago

(repost from https://github.com/nuxt/nuxt.js/issues/7197)

Version

v2.12.2

Reproduction link

https://github.com/MZanggl/nuxt-tailwind-config-purge-bug

Steps to reproduce

Running npm run dev you will see the page displaying a blue background. This is because I added

bodyAttrs: {
      class: 'bg-blue-200'
}

in nuxt.config.js.

Running npm run generate and opening the generated files just returns a white background as the class bg-blue-200 got purged.

What is expected ?

classes inside nuxt.config.js get detected by purgeCSS.

What is actually happening?

purgeCSS does not take class names in nuxt.config.js into consideration so it accidentally purges these classes.