Developmint / nuxt-purgecss

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

Paths options with absolute paths #95

Closed simllll closed 1 year ago

simllll commented 3 years ago

Hi all, thanks for the library :) I came up with one problem, because the paths option is always concatenated with the srcDir option of nuxt. I guess in most cases this is fine, but in my case I have already absolute paths globs to the source files, appending srcDir breaks it therefore. My current workaroudn is to tarnsform them back to relative paths before, but it feels a bit hacky.

See for related code here: https://github.com/Developmint/nuxt-purgecss/blob/032232c70707f1deca8554a163c41677192e61e5/lib/module.js#L40

I would open a PR if it is okay, where we check if the path is absolute (path.isAbsolute) .. and only if not, srcDir is prepended.

What do you think?