Skip to content

Conversation

puckowski
Copy link
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
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
Contributor Author

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

@puckowski puckowski merged commit 145d95e into less:master Dec 8, 2024
6 of 8 checks passed
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