-
Notifications
You must be signed in to change notification settings - Fork 0
/
tailwind.cjs
43 lines (40 loc) · 947 Bytes
/
tailwind.cjs
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
39
40
41
42
43
const createPlugin = require('tailwindcss/plugin');
const mediaAttributes = [
'autoplay',
'autoplay-error',
'buffering',
'captions',
'can-fullscreen',
'can-pip',
'can-load',
'can-play',
'can-seek',
'ended',
'error',
'fullscreen',
'controls',
'loop',
'live',
'live-edge',
'muted',
'paused',
'pip',
'playing',
'playsinline',
'preview',
'seeking',
'started',
'waiting',
'ios-controls',
];
module.exports = createPlugin.withOptions(function (options) {
const selector = options?.selector ?? (options?.webComponents ? 'media-player' : 'div'),
prefixOpt = options?.prefix ?? options?.mediaPrefix,
prefix = prefixOpt ? `${prefixOpt}-` : 'media-';
return function ({ addVariant }) {
mediaAttributes.forEach((name) => {
addVariant(`${prefix}${name}`, `${selector}[data-${name}] &`);
addVariant(`not-${prefix}${name}`, `${selector}:not([data-${name}]) &`);
});
};
});