From 068670e32fbfb7d15ac1484981bbaff530a65ad8 Mon Sep 17 00:00:00 2001 From: Markus Guenther Date: Wed, 12 Apr 2017 10:36:03 +0200 Subject: [PATCH] Add more stylesheet units for the length regex Add px, pt, em, ex and pc as CSS units to detect the length. Otherwise a pt value for instance can not be transformed. --- src/tokenTypes.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tokenTypes.js b/src/tokenTypes.js index 056616a..224f8e6 100644 --- a/src/tokenTypes.js +++ b/src/tokenTypes.js @@ -27,7 +27,7 @@ const identRe = /(^-?[_a-z][_a-z0-9-]*$)/i; // Note if these are wrong, you'll need to change index.js too const numberRe = /^([+-]?(?:\d*\.)?\d+(?:[Ee][+-]?\d+)?)$/; // Note lengthRe is sneaky: you can omit units for 0 -const lengthRe = /^(0$|(?:[+-]?(?:\d*\.)?\d+(?:[Ee][+-]?\d+)?)(?=px$))/; +const lengthRe = /^(0$|(?:[+-]?(?:\d*\.)?\d+(?:[Ee][+-]?\d+)?)(?=(px|pt|em|ex|pc)$))/; const angleRe = /^([+-]?(?:\d*\.)?\d+(?:[Ee][+-]?\d+)?(?:deg|rad))$/; const percentRe = /^([+-]?(?:\d*\.)?\d+(?:[Ee][+-]?\d+)?%)$/;