Skip to content

Commit 0170fe9

Browse files
committed
Now using plugin() function with default values of utility same as Tailwind default utilities.
1 parent 94c505e commit 0170fe9

File tree

1 file changed

+30
-9
lines changed

1 file changed

+30
-9
lines changed

index.js

Lines changed: 30 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,38 @@
1+
12
const _ = require('lodash')
3+
const plugin = require('tailwindcss/plugin')
4+
5+
module.exports = plugin(function({ addUtilities, e, theme, variants }) {
6+
const textShadow = theme('textShadow', {})
7+
8+
const textShadowVariants = variants('textShadow', [])
29

3-
module.exports = function({ addUtilities, e, theme, variants }) {
410
const utilities = _.fromPairs(
5-
_.map(theme('textShadow'), (value, modifier) => {
11+
_.map(textShadow, (value, modifier) => {
612
const className = modifier === 'default' ? 'text-shadow' : `${e(`text-shadow-${modifier}`)}`
7-
return [
13+
return [
814
`.${className}`,
9-
{
10-
'text-shadow': value,
11-
},
12-
]
15+
{
16+
'text-shadow': value,
17+
},
18+
]
1319
})
1420
)
15-
addUtilities(utilities, variants('textShadow'))
16-
}
1721

22+
addUtilities(utilities, textShadowVariants)
23+
},
24+
{
25+
theme: {
26+
textShadow: {
27+
default: '1px 0px 0px rgb(0 0 0 / 20%), 0px 1px 0px rgb(1 0 5 / 10%)',
28+
sm: '1px 1px 3px rgb(36 37 47 / 25%)',
29+
md: '0px 1px 2px rgb(30 29 39 / 19%), 1px 2px 4px rgb(54 64 147 / 18%)',
30+
lg: '3px 3px 6px rgb(0 0 0 / 26%), 0 0 5px rgb(15 3 86 / 22%)',
31+
xl: '1px 1px 3px rgb(0 0 0 / 29%), 2px 4px 7px rgb(73 64 125 / 35%)',
32+
none: 'none',
33+
},
34+
},
35+
variants: {
36+
textShadow: ['responsive', 'hover', 'focus'],
37+
}
38+
})

0 commit comments

Comments
 (0)