Skip to content

Empty values are not parsable. #3737

Closed
Closed
@induane

Description

@induane

To reproduce:

.hover\:drop-shadow-sm {
  --tw-blur:  ;
  --tw-brightness:  ;
}

Current behavior:

Valid CSS yields a ParseError.

Empty values are a valid part of the CSS specification; it's how a custom property to an empty value.

Expected behavior:

I'd expect empty values on custom properties to be included in the output CSS file. This should only be true for custom properties (prefixed with `--``) as empty values like that are NOT valid for normal CSS properties.

Environment information:

  • less version: lessc 4.1.3 (Less Compiler) [JavaScript]
  • npx version: 8.3.0
  • nodejs version: v14.18.2
  • operating system: Linux (PopOS)

Terminal Output

ParseError: Unrecognised input in /home/brant/projects/dk/heimdall-be/manage_ui/static/less/tailwind.less on line 428, column 15:
427 .hover\:drop-shadow-sm {
428   --tw-blur:  ;
429   --tw-brightness:  ;

Other Comments
Obligatory "Why are you doing that?" answer because not including that tends to yield tangential discussions on bug reports. The project uses some custom LESS for legacy reasons, and also includes ForkAwesome. The generated tailwind.css file, along with the custom less files and the forkawesome.css file are all combined with lessc and the minified with the clean-css plugin. This way there is only one CSS payload to pull.

In any case, since values for custom properties like --foo: ; are valid CSS, I'd expect the lessc parser to not implode when encountering such values.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions