Skip to content

Commit a42a8f9

Browse files
committed
feat(source): 增加对rpx的支持
1 parent 00eb6f3 commit a42a8f9

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "reduce-css-calc",
2+
"name": "@jfkued/reduce-css-calc",
33
"version": "2.1.4",
44
"description": "Reduce CSS calc() function to the maximum",
55
"keywords": [

parser.jison

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
([0-9]+("."[0-9]*)?|"."[0-9]+)ex\b return 'EXS';
3131
([0-9]+("."[0-9]*)?|"."[0-9]+)ch\b return 'CHS';
3232
([0-9]+("."[0-9]*)?|"."[0-9]+)rem\b return 'REMS';
33+
([0-9]+("."[0-9]*)?|"."[0-9]+)rpx\b return 'RPXS';
3334
([0-9]+("."[0-9]*)?|"."[0-9]+)vw\b return 'VWS';
3435
([0-9]+("."[0-9]*)?|"."[0-9]+)vh\b return 'VHS';
3536
([0-9]+("."[0-9]*)?|"."[0-9]+)vmin\b return 'VMINS';
@@ -93,6 +94,7 @@ expression
9394
| EXS { $$ = { type: 'ExValue', value: parseFloat($1), unit: 'ex' }; }
9495
| CHS { $$ = { type: 'ChValue', value: parseFloat($1), unit: 'ch' }; }
9596
| REMS { $$ = { type: 'RemValue', value: parseFloat($1), unit: 'rem' }; }
97+
| RPXS { $$ = { type: 'RpxValue', value: parseFloat($1), unit: 'rpx' }; }
9698
| VHS { $$ = { type: 'VhValue', value: parseFloat($1), unit: 'vh' }; }
9799
| VWS { $$ = { type: 'VwValue', value: parseFloat($1), unit: 'vw' }; }
98100
| VMINS { $$ = { type: 'VminValue', value: parseFloat($1), unit: 'vmin' }; }

0 commit comments

Comments
 (0)