|
Last change
on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 12 days ago |
|
Fix frontend appearance
|
-
Property mode
set to
100644
|
|
File size:
1.0 KB
|
| Line | |
|---|
| 1 | /**
|
|---|
| 2 | * This function removes any uses of CSS variables used as an alpha channel
|
|---|
| 3 | *
|
|---|
| 4 | * This is required for selectors like `:visited` which do not allow
|
|---|
| 5 | * changes in opacity or external control using CSS variables.
|
|---|
| 6 | *
|
|---|
| 7 | * @param {import('postcss').Container} container
|
|---|
| 8 | * @param {string[]} toRemove
|
|---|
| 9 | */ "use strict";
|
|---|
| 10 | Object.defineProperty(exports, "__esModule", {
|
|---|
| 11 | value: true
|
|---|
| 12 | });
|
|---|
| 13 | Object.defineProperty(exports, "removeAlphaVariables", {
|
|---|
| 14 | enumerable: true,
|
|---|
| 15 | get: function() {
|
|---|
| 16 | return removeAlphaVariables;
|
|---|
| 17 | }
|
|---|
| 18 | });
|
|---|
| 19 | function removeAlphaVariables(container, toRemove) {
|
|---|
| 20 | container.walkDecls((decl)=>{
|
|---|
| 21 | if (toRemove.includes(decl.prop)) {
|
|---|
| 22 | decl.remove();
|
|---|
| 23 | return;
|
|---|
| 24 | }
|
|---|
| 25 | for (let varName of toRemove){
|
|---|
| 26 | if (decl.value.includes(`/ var(${varName})`)) {
|
|---|
| 27 | decl.value = decl.value.replace(`/ var(${varName})`, "");
|
|---|
| 28 | } else if (decl.value.includes(`/ var(${varName}, 1)`)) {
|
|---|
| 29 | decl.value = decl.value.replace(`/ var(${varName}, 1)`, "");
|
|---|
| 30 | }
|
|---|
| 31 | }
|
|---|
| 32 | });
|
|---|
| 33 | }
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.