There seem to be some patterns in LessCSS (1.7.x) that allow (pre/post)-processing of a CSS render tree. I was wondering if it was possible to use the Visitor (I tried that, but couldn't make it work - or anything else) to remove properties from the CSS output upon rendering. E.g. if the output was
a {
font-size: 12px;
-some-aribitrary-property: value;
}
I would like to remove -some-arbitrary-property
from the CSS output when calling .toCSS
.
I can't seem to find any documentation about this, only references to the upcoming version 2.0 - does anyone know if this is even possible and if yes how to do so, or point me to some example?
I tried to make this an edit to @bass-jobsen's post, but it got rejected with the reason it should be an answer. So for Less 1.7.x, you create a visitor class:
then in your parsing code, use it like this:
patching of less itself (like in @bass-jobsen's answer) is not needed.