Remove target helper

This commit is contained in:
Adam Wathan 2020-04-27 09:03:50 -04:00
parent 1c353af37d
commit e5288ff8fe
3 changed files with 27 additions and 37 deletions

View file

@ -1,21 +1,18 @@
export default function() {
return function({ addUtilities, variants, target }) {
target(
return function({ addUtilities, variants, config }) {
if (config('target') === 'ie11') {
return
}
addUtilities(
{
ie11: () => {},
'.object-contain': { 'object-fit': 'contain' },
'.object-cover': { 'object-fit': 'cover' },
'.object-fill': { 'object-fit': 'fill' },
'.object-none': { 'object-fit': 'none' },
'.object-scale-down': { 'object-fit': 'scale-down' },
},
() => {
addUtilities(
{
'.object-contain': { 'object-fit': 'contain' },
'.object-cover': { 'object-fit': 'cover' },
'.object-fill': { 'object-fit': 'fill' },
'.object-none': { 'object-fit': 'none' },
'.object-scale-down': { 'object-fit': 'scale-down' },
},
variants('objectFit')
)
}
variants('objectFit')
)
}
}

View file

@ -1,25 +1,22 @@
import _ from 'lodash'
export default function() {
return function({ addUtilities, e, theme, variants, target }) {
target(
{
ie11: () => {},
},
() => {
const utilities = _.fromPairs(
_.map(theme('objectPosition'), (value, modifier) => {
return [
`.${e(`object-${modifier}`)}`,
{
'object-position': value,
},
]
})
)
return function({ addUtilities, e, theme, variants, config }) {
if (config('target') === 'ie11') {
return
}
addUtilities(utilities, variants('objectPosition'))
}
const utilities = _.fromPairs(
_.map(theme('objectPosition'), (value, modifier) => {
return [
`.${e(`object-${modifier}`)}`,
{
'object-position': value,
},
]
})
)
addUtilities(utilities, variants('objectPosition'))
}
}

View file

@ -27,9 +27,6 @@ export default function(plugins, config) {
return prefixSelector(config.prefix, selector)
}
const getConfigValue = (path, defaultValue) => _.get(config, path, defaultValue)
const target = (targets, defaultTarget) => {
return _.get(targets, getConfigValue('target'), defaultTarget)()
}
plugins.forEach(plugin => {
if (plugin.__isOptionsFunction) {
@ -41,7 +38,6 @@ export default function(plugins, config) {
handler({
postcss,
config: getConfigValue,
target,
theme: (path, defaultValue) => getConfigValue(`theme.${path}`, defaultValue),
variants: (path, defaultValue) => {
if (Array.isArray(config.variants)) {