Fallen
Fallen

Reputation: 335

Less processes css as invalid

I'm trying to use https://github.com/Idered/cssParentSelector with less. I'm wondering if there's a way to have less ignore a few lines and just add them as is to a css file.

body! > .modal-trigger:checked { overflow: hidden; } presents a ParseError: Unrecognised input error.

If you put body! > .modal-trigger:checked { overflow: hidden; } in a css file it works as expected.

Upvotes: 0

Views: 59

Answers (1)

seven-phases-max
seven-phases-max

Reputation: 11820

Instead of ignoring the whole line (which would require too cryptic tricks) you can ignore just the invalid character, e.g.:

@excl: !;
body@{excl} > .modal-trigger:checked {overflow: hidden}

Alternatively you can move all that non-CSS into a separate CSS file and include it with (inline) option so Less will just copy its contents w/o parsing:

@import (inline) "whatever.css";

Another alternative would be to use CSS escaping but only if it is supported by the polyfill as well:

body\! > .modal-trigger:checked {overflow: hidden}

Upvotes: 1

Related Questions