less / less/less.js

Extension of reference imported selector produces inconsistent output

Open
#3,222 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug low priority
Dominant language
JavaScript
Stars
17k
Forks
3.4k
Avg merge
7h 42m
Merged PRs (30d)
26

Description

Files:

test.less

@import (reference) 'test-referenced.less';
@import 'test-extensions.less';

test-referenced.less

.font-base {
	font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
	letter-spacing: .05em;
}
.clearfix {
	&:before,
	&:after {
		content: " ";
		display: table;
	}
}

test-extensions.less

.font-extension {
	&:extend(.font-base all);
}
.a-clearfixed-thing {
	&:extend(.clearfix all);
}

Command
lessc test.less

v2.7.1 & Expected Output
.font-extension {
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  letter-spacing: .05em;
}
.a-clearfixed-thing:before,
.a-clearfixed-thing:after {
  content: " ";
  display: table;
}
v3.0.4 Output
.font-extension {
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;letter-spacing: .05em;
}
.a-clearfixed-thing:before,
.a-clearfixed-thing:after {
  content: " ";display: table;
}

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by running the provided test.less, test-referenced.less, and test-extensions.less inputs with lessc and compare the v3.0.4 output with the expected v2.7.1 formatting. Trace the reference import and extension output path, then verify that declarations are separated consistently in the generated CSS.

Written by the indexing model from the issue text.

Assessment

Tech stack
css, javascript
Domain
compilers
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.