DivZero
DivZero

Reputation: 2438

LESSCSS escaping filter

I need my LESS file to compile the following filter:

filter: url("data:image/svg+xml;utf8,<svg xmlns=\'http://www.w3.org/2000/svg\'><filter id=\'grayscale\'><feColorMatrix type=\'matrix\' values=\'0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0 0 0 1 0\'/></filter></svg>#grayscale");

I can't seem to figure out the correct syntax to escape it, as LESS is stripping the + sign and the spaces. I managed to keep the + sign by adding a backslash. But this did not work for the spaces. I'm sure it's super easy but I can't figure it out ;-)

Upvotes: 0

Views: 538

Answers (1)

ScottS
ScottS

Reputation: 72261

Try this:

filter: ~"url('data:image/svg+xml;utf8,<svg xmlns=\'http://www.w3.org/2000/svg\'><filter id=\'grayscale\'><feColorMatrix type=\'matrix\' values=\'0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0 0 0 1 0\'/></filter></svg>#grayscale')";

Upvotes: 2

Related Questions