|
Last change
on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 11 days ago |
|
Fix frontend appearance
|
-
Property mode
set to
100644
|
|
File size:
785 bytes
|
| 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 | */
|
|---|
| 10 | export function removeAlphaVariables(container, toRemove) {
|
|---|
| 11 | container.walkDecls((decl) => {
|
|---|
| 12 | if (toRemove.includes(decl.prop)) {
|
|---|
| 13 | decl.remove()
|
|---|
| 14 |
|
|---|
| 15 | return
|
|---|
| 16 | }
|
|---|
| 17 |
|
|---|
| 18 | for (let varName of toRemove) {
|
|---|
| 19 | if (decl.value.includes(`/ var(${varName})`)) {
|
|---|
| 20 | decl.value = decl.value.replace(`/ var(${varName})`, '')
|
|---|
| 21 | } else if (decl.value.includes(`/ var(${varName}, 1)`)) {
|
|---|
| 22 | decl.value = decl.value.replace(`/ var(${varName}, 1)`, '')
|
|---|
| 23 | }
|
|---|
| 24 | }
|
|---|
| 25 | })
|
|---|
| 26 | }
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.