Skip to content

Commit d698ac7

Browse files
committed
fix(issue:3737) allow blank variable declarations
* Fixes issue with blank CSS variable declarations.
1 parent 773e157 commit d698ac7

File tree

3 files changed

+21
-1
lines changed

3 files changed

+21
-1
lines changed

packages/less/src/less/parser/parser.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import getParserInput from './parser-input';
55
import * as utils from '../utils';
66
import functionRegistry from '../functions/function-registry';
77
import { ContainerSyntaxOptions, MediaSyntaxOptions } from '../tree/atrule-syntax';
8+
import Anonymous from '../tree/anonymous';
89

910
//
1011
// less.js - parser
@@ -1578,7 +1579,11 @@ const Parser = function Parser(context, imports, fileInfo, currentIndex) {
15781579

15791580
// Custom property values get permissive parsing
15801581
if (name[0].value && name[0].value.slice(0, 2) === '--') {
1581-
value = this.permissiveValue(/[;}]/);
1582+
if (parserInput.$char(';')) {
1583+
value = new Anonymous('');
1584+
} else {
1585+
value = this.permissiveValue(/[;}]/);
1586+
}
15821587
}
15831588
// Try to store values as anonymous
15841589
// If we need the value later we'll re-parse it in ruleset.parseValue

packages/test-data/css/_main/variables.css

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,3 +69,11 @@
6969
mul-px-2: 140px;
7070
mul-px-3: 140px;
7171
}
72+
*,
73+
::before,
74+
::after {
75+
--tw-pan-x: ;
76+
--tw-pan-y: ;
77+
--tw-pinch-zoom: ;
78+
--tw-scroll-snap-strictness: proximity;
79+
}

packages/test-data/less/_main/variables.less

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,3 +125,10 @@
125125
mul-px-3: ((@px * 1) * @cm);
126126
}
127127
}
128+
129+
*, ::before, ::after {
130+
--tw-pan-x: ;
131+
--tw-pan-y: ;
132+
--tw-pinch-zoom: ;
133+
--tw-scroll-snap-strictness: proximity;
134+
}

0 commit comments

Comments
 (0)