Port svgFill module to plugin

This commit is contained in:
Adam Wathan 2019-01-09 13:15:21 -05:00
parent efb9e6953d
commit e6c0da03df
4 changed files with 15 additions and 12 deletions

View file

@ -1,3 +1,4 @@
import svgFill from './plugins/svgFill'
import svgStroke from './plugins/svgStroke'
import tableLayout from './plugins/tableLayout'
import textAlign from './plugins/textAlign'
@ -13,6 +14,7 @@ import width from './plugins/width'
import zIndex from './plugins/zIndex'
export default [
svgFill(),
svgStroke(),
tableLayout(),
textAlign(),

View file

@ -1,10 +0,0 @@
import _ from 'lodash'
import defineClass from '../util/defineClass'
export default function({ svgFill }) {
return _.map(svgFill, (color, modifier) => {
return defineClass(`fill-${modifier}`, {
fill: color,
})
})
}

13
src/plugins/svgFill.js Normal file
View file

@ -0,0 +1,13 @@
import _ from 'lodash'
export default function () {
return function ({ addUtilities, config, e }) {
const utilities = _.fromPairs(_.map(config('svgFill'), (value, modifier) => {
return [`.${e(`fill-${modifier}`)}`, {
'fill': value,
}]
}))
addUtilities(utilities, config('modules.svgFill'))
}
}

View file

@ -34,7 +34,6 @@ import pointerEvents from './generators/pointerEvents'
import position from './generators/position'
import resize from './generators/resize'
import shadows from './generators/shadows'
import svgFill from './generators/svgFill'
export default [
{ name: 'lists', generator: lists },
@ -73,5 +72,4 @@ export default [
{ name: 'position', generator: position },
{ name: 'resize', generator: resize },
{ name: 'shadows', generator: shadows },
{ name: 'svgFill', generator: svgFill },
]