Last change
on this file since 188ee53 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
887 bytes
|
Line | |
---|
1 | 'use strict';
|
---|
2 |
|
---|
3 | function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
|
---|
4 |
|
---|
5 | var postcss = _interopDefault(require('postcss'));
|
---|
6 |
|
---|
7 | const selectorRegExp = /:focus-visible([^\w-]|$)/gi;
|
---|
8 | var index = postcss.plugin('postcss-focus-visible', opts => {
|
---|
9 | const replaceWith = String(Object(opts).replaceWith || '.focus-visible');
|
---|
10 | const preserve = Boolean('preserve' in Object(opts) ? opts.preserve : true);
|
---|
11 | return root => {
|
---|
12 | root.walkRules(selectorRegExp, rule => {
|
---|
13 | const selector = rule.selector.replace(selectorRegExp, ($0, $1) => {
|
---|
14 | return `${replaceWith}${$1}`;
|
---|
15 | });
|
---|
16 | const clone = rule.clone({
|
---|
17 | selector
|
---|
18 | });
|
---|
19 |
|
---|
20 | if (preserve) {
|
---|
21 | rule.before(clone);
|
---|
22 | } else {
|
---|
23 | rule.replaceWith(clone);
|
---|
24 | }
|
---|
25 | });
|
---|
26 | };
|
---|
27 | });
|
---|
28 |
|
---|
29 | module.exports = index;
|
---|
30 | //# sourceMappingURL=index.cjs.js.map
|
---|
Note:
See
TracBrowser
for help on using the repository browser.