Reduce calls of flattenColorPalette

This commit is contained in:
Irene Lin 2020-05-07 00:22:07 +10:00
parent 99a5fea06d
commit 2ba2b72fc8
6 changed files with 20 additions and 12 deletions

View file

@ -4,9 +4,11 @@ import withAlphaVariable from '../util/withAlphaVariable'
export default function() {
return function({ addUtilities, e, theme, variants, target, corePlugins }) {
const colors = flattenColorPalette(theme('backgroundColor'))
if (target('backgroundColor') === 'ie11') {
const utilities = _.fromPairs(
_.map(flattenColorPalette(theme('backgroundColor')), (value, modifier) => {
_.map(colors, (value, modifier) => {
return [`.${e(`bg-${modifier}`)}`, { 'background-color': value }]
})
)
@ -17,7 +19,7 @@ export default function() {
}
const utilities = _.fromPairs(
_.map(flattenColorPalette(theme('backgroundColor')), (value, modifier) => {
_.map(colors, (value, modifier) => {
return [
`.${e(`bg-${modifier}`)}`,
corePlugins('backgroundOpacity')