Reduce calls of flattenColorPalette
This commit is contained in:
parent
99a5fea06d
commit
2ba2b72fc8
6 changed files with 20 additions and 12 deletions
|
|
@ -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')
|
||||
|
|
|
|||
|
|
@ -4,9 +4,9 @@ import withAlphaVariable from '../util/withAlphaVariable'
|
|||
|
||||
export default function() {
|
||||
return function({ addUtilities, e, theme, variants, target, corePlugins }) {
|
||||
if (target('borderColor') === 'ie11') {
|
||||
const colors = flattenColorPalette(theme('borderColor'))
|
||||
const colors = flattenColorPalette(theme('borderColor'))
|
||||
|
||||
if (target('borderColor') === 'ie11') {
|
||||
const utilities = _.fromPairs(
|
||||
_.map(_.omit(colors, 'default'), (value, modifier) => {
|
||||
return [`.${e(`border-${modifier}`)}`, { 'border-color': value }]
|
||||
|
|
@ -18,8 +18,6 @@ export default function() {
|
|||
return
|
||||
}
|
||||
|
||||
const colors = flattenColorPalette(theme('borderColor'))
|
||||
|
||||
const utilities = _.fromPairs(
|
||||
_.map(_.omit(colors, 'default'), (value, modifier) => {
|
||||
return [
|
||||
|
|
|
|||
|
|
@ -3,8 +3,10 @@ import flattenColorPalette from '../util/flattenColorPalette'
|
|||
|
||||
export default function() {
|
||||
return function({ addUtilities, e, theme, variants }) {
|
||||
const colors = flattenColorPalette(theme('fill'))
|
||||
|
||||
const utilities = _.fromPairs(
|
||||
_.map(flattenColorPalette(theme('fill')), (value, modifier) => {
|
||||
_.map(colors, (value, modifier) => {
|
||||
return [
|
||||
`.${e(`fill-${modifier}`)}`,
|
||||
{
|
||||
|
|
|
|||
|
|
@ -4,9 +4,11 @@ import withAlphaVariable from '../util/withAlphaVariable'
|
|||
|
||||
export default function() {
|
||||
return function({ addUtilities, e, theme, variants, target, corePlugins }) {
|
||||
const colors = flattenColorPalette(theme('placeholderColor'))
|
||||
|
||||
if (target('placeholderColor') === 'ie11') {
|
||||
const utilities = _.fromPairs(
|
||||
_.map(flattenColorPalette(theme('placeholderColor')), (value, modifier) => {
|
||||
_.map(colors, (value, modifier) => {
|
||||
return [`.${e(`placeholder-${modifier}`)}::placeholder`, { color: value }]
|
||||
})
|
||||
)
|
||||
|
|
@ -17,7 +19,7 @@ export default function() {
|
|||
}
|
||||
|
||||
const utilities = _.fromPairs(
|
||||
_.map(flattenColorPalette(theme('placeholderColor')), (value, modifier) => {
|
||||
_.map(colors, (value, modifier) => {
|
||||
return [
|
||||
`.${e(`placeholder-${modifier}`)}::placeholder`,
|
||||
corePlugins('placeholderOpacity')
|
||||
|
|
|
|||
|
|
@ -3,8 +3,10 @@ import flattenColorPalette from '../util/flattenColorPalette'
|
|||
|
||||
export default function() {
|
||||
return function({ addUtilities, e, theme, variants }) {
|
||||
const colors = flattenColorPalette(theme('stroke'))
|
||||
|
||||
const utilities = _.fromPairs(
|
||||
_.map(flattenColorPalette(theme('stroke')), (value, modifier) => {
|
||||
_.map(colors, (value, modifier) => {
|
||||
return [
|
||||
`.${e(`stroke-${modifier}`)}`,
|
||||
{
|
||||
|
|
|
|||
|
|
@ -4,9 +4,11 @@ import withAlphaVariable from '../util/withAlphaVariable'
|
|||
|
||||
export default function() {
|
||||
return function({ addUtilities, e, theme, variants, target, corePlugins }) {
|
||||
const colors = flattenColorPalette(theme('textColor'))
|
||||
|
||||
if (target('textColor') === 'ie11') {
|
||||
const utilities = _.fromPairs(
|
||||
_.map(flattenColorPalette(theme('textColor')), (value, modifier) => {
|
||||
_.map(colors, (value, modifier) => {
|
||||
return [`.${e(`text-${modifier}`)}`, { color: value }]
|
||||
})
|
||||
)
|
||||
|
|
@ -17,7 +19,7 @@ export default function() {
|
|||
}
|
||||
|
||||
const utilities = _.fromPairs(
|
||||
_.map(flattenColorPalette(theme('textColor')), (value, modifier) => {
|
||||
_.map(colors, (value, modifier) => {
|
||||
return [
|
||||
`.${e(`text-${modifier}`)}`,
|
||||
corePlugins('textOpacity')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue