Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions lib/tailwindConfigUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,23 +14,23 @@ const flattenColorPalette = require(flattenColorPalettePath).default
const resolveConfigPath = configPath => path.resolve(process.cwd(), configPath)

const resolveConfig = config => {
return transformConfig(resolveTailwindConfig(config))
return transformConfig(resolveTailwindConfig(config), config)
}

const resolveConfigToJson = async (configPath) => {
const config = await import(configPath)
return JSON.stringify(resolveConfig(config.default || config))
}

const transformConfig = config => {
const transformConfig = (config, unResolvedConfig) => {
config.tailwindVersion = tailwindVersion
config.theme = replaceWithOverrides(config.theme)
config.theme.colors = flattenColorPalette(config.theme.colors)
config.theme.backgroundColor = flattenColorPalette(config.theme.backgroundColor)
config.theme.textColor = flattenColorPalette(config.theme.textColor)
config.theme.borderColor = flattenColorPalette(config.theme.borderColor)

removeDisabledCorePlugins(config)
removeDisabledCorePlugins(config, unResolvedConfig)

removeConfigProps(config, [
'variants',
Expand Down Expand Up @@ -71,9 +71,9 @@ const removeConfigProps = (config, props) => {
props.forEach(prop => delete config[prop])
}

const removeDisabledCorePlugins = (config) => {
Object.keys(config.corePlugins).forEach(key => {
if (config.corePlugins[key] === false) {
const removeDisabledCorePlugins = (config, unResolvedConfig) => {
Object.keys(unResolvedConfig.corePlugins).forEach(key => {
if (unResolvedConfig.corePlugins[key] === false) {
delete config.theme[key]
}
})
Expand Down