Skip to content

Commit 4715bda

Browse files
committed
Port borderColors module to plugin
1 parent 2a0b64f commit 4715bda

File tree

4 files changed

+15
-12
lines changed

4 files changed

+15
-12
lines changed

src/defaultPlugins.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import borderColors from './plugins/borderColors'
12
import borderRadius from './plugins/borderRadius'
23
import borderStyle from './plugins/borderStyle'
34
import borderWidths from './plugins/borderWidths'
@@ -42,6 +43,7 @@ import zIndex from './plugins/zIndex'
4243

4344
export default function (config) {
4445
return [
46+
config.modules.borderColors === false ? () => {} : borderColors(),
4547
config.modules.borderRadius === false ? () => {} : borderRadius(),
4648
config.modules.borderStyle === false ? () => {} : borderStyle(),
4749
config.modules.borderWidths === false ? () => {} : borderWidths(),

src/generators/borderColors.js

Lines changed: 0 additions & 10 deletions
This file was deleted.

src/plugins/borderColors.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import _ from 'lodash'
2+
3+
export default function () {
4+
return function ({ addUtilities, config, e }) {
5+
const utilities = _.fromPairs(_.map(_.omit(config('borderColors'), 'default'), (value, modifier) => {
6+
return [`.${e(`border-${modifier}`)}`, {
7+
'border-color': value,
8+
}]
9+
}))
10+
11+
addUtilities(utilities, config('modules.borderColors'))
12+
}
13+
}

src/utilityModules.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import backgroundPosition from './generators/backgroundPosition'
66
import backgroundRepeat from './generators/backgroundRepeat'
77
import backgroundSize from './generators/backgroundSize'
88
import borderCollapse from './generators/borderCollapse'
9-
import borderColors from './generators/borderColors'
109

1110
export default [
1211
{ name: 'lists', generator: lists },
@@ -17,5 +16,4 @@ export default [
1716
{ name: 'backgroundRepeat', generator: backgroundRepeat },
1817
{ name: 'backgroundSize', generator: backgroundSize },
1918
{ name: 'borderCollapse', generator: borderCollapse },
20-
{ name: 'borderColors', generator: borderColors },
2119
]

0 commit comments

Comments
 (0)