diff options
Diffstat (limited to 'lib/rfs.js')
-rw-r--r-- | lib/rfs.js | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -81,7 +81,9 @@ module.exports = class { return; } - node.nodes.filter(node => node.type === 'word').forEach(node => { + const wordNodes = node.nodes.filter(node => node.type === 'word'); + + for (const node of wordNodes) { node.value = node.value.replace(/^(-?\d*\.?\d+)(.*)/g, (match, value, unit) => { value = Number.parseFloat(value); @@ -116,7 +118,7 @@ module.exports = class { return `calc(-${this.toFixed(baseValue, this.opts.unitPrecision)}${this.opts.unit} - ${this.toFixed(diff * 100 / this.opts.breakpoint, this.opts.unitPrecision)}${viewportUnit})`; }); - }); + } // Now we will transform the existing rgba() function node // into a word node with the hex value |