forked from benface/tailwindcss-filters
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
38 lines (35 loc) · 867 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
const plugin = require('tailwindcss/plugin');
const _ = require('lodash');
module.exports = plugin(function({ theme, variants, e, addUtilities }) {
const filterUtilities = _.fromPairs(
_.map(theme('filter'), (value, modifier) => {
return [
`.${e(`filter-${modifier}`)}`,
{
filter: value,
},
];
})
);
const backdropFilterUtilities = _.fromPairs(
_.map(theme('backdropFilter'), (value, modifier) => {
return [
`.${e(`backdrop-${modifier}`)}`,
{
backdropFilter: value,
},
];
})
);
addUtilities(filterUtilities, variants('filter'));
addUtilities(backdropFilterUtilities, variants('backdropFilter'));
}, {
theme: {
filter: {},
backdropFilter: {},
},
variants: {
filter: ['responsive'],
backdropFilter: ['responsive'],
},
});