Skip to content

fix(issue:4264) strip line comment from expression#4293

Merged
puckowski merged 1 commit intoless:masterfrom
puckowski:master_fix_4264_2
Dec 8, 2024
Merged

fix(issue:4264) strip line comment from expression#4293
puckowski merged 1 commit intoless:masterfrom
puckowski:master_fix_4264_2

Conversation

@puckowski
Copy link
Copy Markdown
Contributor

What:

Fix for issue #4264. Strip line comments from expressions to avoid invalid CSS output.

Why:

Less.js currently takes CSS like:

@items:
// Fruit
    apple,
    banana,
    cherry,

// Vegetables
    carrot,
    potato,
;

each(@items, {
  div#@{value} {
    color: blue;
  }
})

and outputs:

div#apple {
  color: blue;
}
div#banana {
  color: blue;
}
div#cherry {
  color: blue;
}
div#// Vegetables carrot {
  color: blue;
}
div#potato {
  color: blue;
}

With fix the output is:

div#apple {
  color: blue;
}
div#banana {
  color: blue;
}
div#cherry {
  color: blue;
}
div#carrot {
  color: blue;
}
div#potato {
  color: blue;
}

Checklist:

  • Documentation
  • Added/updated unit tests
  • Code complete

Tests passing locally. Updated tests for variables.

@dosubot dosubot bot added the size:M This PR changes 30-99 lines, ignoring generated files. label Nov 28, 2024
@puckowski
Copy link
Copy Markdown
Contributor Author

I submitted a few PRs. I expect rebase(s) will be needed in order to merge all of them, so let me know when a rebase is needed.

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Dec 7, 2024
* Fix for issue less#4264. Strip line comments from expressions to avoid
  invalid CSS output.
@puckowski
Copy link
Copy Markdown
Contributor Author

Rebased after merge conflict. Changes approved by one reviewer. Some CI looks flaky. Squashing and merging to avoid future merge conflicts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lgtm This PR has been approved by a maintainer size:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants