MCPcopy Create free account
hub / github.com/Khan/perseus / stringifyCssProperty

Function stringifyCssProperty

utils/extract-css.js:578–589  ·  view source on GitHub ↗
(cssProperty, indentationCount = 1)

Source from the content-addressed store, hash-verified

576};
577
578const stringifyCssProperty = (cssProperty, indentationCount = 1) => {
579 const property = `${indentation.repeat(indentationCount)}${cssProperty.property}: ${cssProperty.value};`;
580 const trailingComments =
581 cssProperty.trailingComments.length === 0
582 ? ""
583 : ` /* ${cssProperty.trailingComments.map((comment) => comment.value.trim()).join(" ")} */`;
584 const leadingComments = stringifyComments(
585 cssProperty.leadingComments,
586 indentationCount + 1,
587 );
588 return `${leadingComments}${property}${trailingComments}${"\n"}`;
589};
590
591const stringifyCssRuleset = (selector, ruleset, indentationCount = 0) => {
592 // Conditional rulesets contain a class name in the nested ruleset.

Callers 1

stringifyCssRulesetFunction · 0.85

Calls 1

stringifyCommentsFunction · 0.85

Tested by

no test coverage detected