Implementation of a insideAtApply variable

Implementation of a insideAtApply variable to determine if it is a Tailwind ruleset and avoid whitespace after variant [ currently thinking it is a property ]
This commit is contained in:
MHO 2023-04-18 09:40:46 +02:00 committed by GitHub
parent 686f8c1b26
commit 7032cbd425
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -195,6 +195,7 @@ Beautifier.prototype.beautify = function() {
var enteringConditionalGroup = false;
var insideAtExtend = false;
var insideAtImport = false;
var insideAtApply = false;
var insideScssMap = false;
var topCharacter = this._ch;
var insideNonSemiColonValues = false;
@ -276,6 +277,11 @@ Beautifier.prototype.beautify = function() {
insideAtImport = true;
}
// might be a tailwindcss ruleset
if (variableOrRule === 'apply') {
insideAtApply = true;
}
// might be a nesting at-rule
if (variableOrRule in this.NESTED_AT_RULE) {
this._nestedLevel += 1;
@ -339,6 +345,7 @@ Beautifier.prototype.beautify = function() {
}
insideAtImport = false;
insideAtExtend = false;
insideAtApply = false;
if (insidePropertyValue) {
this.outdent();
insidePropertyValue = false;
@ -372,9 +379,10 @@ Beautifier.prototype.beautify = function() {
}
}
if ((insideRule || enteringConditionalGroup) && !(this._input.lookBack("&") || this.foundNestedPseudoClass()) && !this._input.lookBack("(") && !insideAtExtend && parenLevel === 0) {
if ((insideRule || enteringConditionalGroup) && !(this._input.lookBack("&") || this.foundNestedPseudoClass()) && !this._input.lookBack("(") && !insideAtExtend && !insideAtApply && parenLevel === 0) {
// 'property: value' delimiter
// which could be in a conditional group query
this.print_string(':');
if (!insidePropertyValue) {
insidePropertyValue = true;