Remove default values from config that have default values even when not present at all

This commit is contained in:
Adam Wathan 2020-10-17 20:27:21 -04:00
parent cdb0f07f6e
commit 9d40ef519c
4 changed files with 12 additions and 6 deletions

View File

@ -58,6 +58,8 @@ const config = {
},
}
delete config.presets
function assertPurged(result) {
expect(result.css).not.toContain('.bg-red-600')
expect(result.css).not.toContain('.w-1\\/3')

View File

@ -1,10 +1,12 @@
import postcss from 'postcss'
import plugin from '../src/lib/substituteVariantsAtRules'
import processPlugins from '../src/util/processPlugins'
import resolveConfig from '../src/util/resolveConfig'
import config from '../stubs/defaultConfig.stub.js'
function run(input, opts = config) {
return postcss([plugin(opts, processPlugins(opts.plugins, opts))]).process(input, {
const resolved = resolveConfig([opts])
return postcss([plugin(resolved, processPlugins(resolved.plugins, resolved))]).process(input, {
from: undefined,
})
}

View File

@ -220,6 +220,11 @@ export default function resolveConfig(configs) {
corePlugins: resolveCorePlugins(allConfigs.map((c) => c.corePlugins)),
plugins: resolvePluginLists(configs.map((c) => get(c, 'plugins', []))),
},
...allConfigs
...allConfigs,
{
prefix: '',
important: false,
separator: ':',
}
)
}

View File

@ -4,9 +4,7 @@ module.exports = {
// purgeLayersByDefault: true,
},
purge: [],
prefix: '',
important: false,
separator: ':',
presets: [],
theme: {
screens: {
sm: '640px',
@ -818,6 +816,5 @@ module.exports = {
transitionDelay: ['responsive'],
animation: ['responsive'],
},
corePlugins: {},
plugins: [],
}