Closed oleersoy closed 7 years ago
PR welcome, but please triple check the spec to be sure.
I think this comment needs some updating:
/**
* Resolve CSS variables in a value
*
* The second argument to a CSS variable function, if provided, is a fallback
* value, which is used as the substitution value when the referenced variable
* is invalid.
*
* var(name[, fallback])
*
* @param {String} value A property value known to contain CSS variable
* functions
* @param {Object} variables A map of variable names and values
* @param {Object} source source object of the declaration containing the rule
* @return {String} A property value with all CSS variables substituted.
*/
function resolveValue(value, variables, result, decl) {
var results = []
Here's a partial attempt:
/**
* Resolve CSS variables.
*
* The second argument to the CSS variable function, var(name[, fallback]),
* is used in the event that first argument cannot be resolved.
*
* @param {String} value May contain the CSS variable function
* @param {Object} variables A map of variable names and values
* @param {Object} result WHAT IS THE RESULT
* @param {Object} decl Source object of the declaration containing the rule
* @return {String} A property value with all CSS variables substituted.
*/
function resolveValue(value, variables, result, decl) {
var results = []
WDYT? ... And I'm not sure what the result
parameter is?
Comment is indeed probably outdated; result is postcss result object.
Ok I updated the comment and sent a PR. I'll try to keep the PRs small, but just let me know if you have a preferred way of doing it.
Variable:
:root { --Button.onDisabled-opacity: 0.6; }
Template definition:
Rendering
I asked on SO if periods are allowed per the specification
To reproduce the above description: