(node: FunctionNode)
| 523 | }; |
| 524 | |
| 525 | export const parseCssVar = (node: FunctionNode): undefined | VarValue => { |
| 526 | const [name, _comma, ...fallback] = node.children; |
| 527 | const fallbackString = generate({ |
| 528 | type: "Value", |
| 529 | loc: null, |
| 530 | children: new List<CssNode>().fromArray(fallback), |
| 531 | }).trim(); |
| 532 | if (name.type === "Identifier") { |
| 533 | const value: VarValue = { |
| 534 | type: "var", |
| 535 | value: name.name.slice("--".length), |
| 536 | }; |
| 537 | if (fallback.length > 0) { |
| 538 | value.fallback = { type: "unparsed", value: fallbackString }; |
| 539 | } |
| 540 | return value; |
| 541 | } |
| 542 | }; |
| 543 | |
| 544 | const parseLiteral = ( |
| 545 | node: undefined | null | CssNode, |
no test coverage detected