Developmint / nuxt-purgecss

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

Enable option merging for whitelistPatternsChildren and whitelistPatterns #29

Closed DonNicoJs closed 5 years ago

DonNicoJs commented 5 years ago

Currently whitelistPatternsChildren and whitelistPatterns https://www.purgecss.com/whitelisting#patterns are not initialised ( as empty array) in the internal plugin config and so skipped by this function:

const mergedConfig = Object.entries(purgeCSS).reduce((options, [key, value]) => {
    const defaultValue = defaults[key]

    if (value && typeof value !== 'function' && Array.isArray(defaultValue)) {
      // Merge value with default value if array
      value = defaultValue.concat(value)
    } else if (typeof value === 'function') {
      // Executed value functions and provide default value as param
      value = value(defaultValue)
    }

    // Finally assign
    options[key] = value
    return options
  }, {})

PR to come

DonNicoJs commented 5 years ago

@manniL shall I close this ?

manniL commented 5 years ago

@lordfuoco Yes, feel free to do so ☺️

PS: You can use Resolve #ISSUE in the PR to auto-close issues after merging ☺️

DonNicoJs commented 5 years ago

@manniL opsie, true, forgot about that! Thanks!