You need to escape the filters, and the code (I thought) needed to be input all on one line (but see below). However, you can add a newline to output cleanly if you want. So this (with newlines and spacing added):
.rotate(@degrees: 45deg) {
-webkit-transform: rotate(@degrees);
-moz-transform: rotate(@degrees);
-ms-transform: rotate(@degrees);
-o-transform: rotate(@degrees);
transform: rotate(@degrees);
@cos: cos(@degrees);
@sin: sin(@degrees);
@nl: `"\n"`; // Newline
/* IE8- */
filter: ~"progid:DXImageTransform.Microsoft.Matrix(@{nl} M11=@{cos},@{nl} M12=-@{sin},@{nl} M21=@{sin},@{nl} M22=@{cos},@{nl} sizingMethod='auto expand'@{nl} )";
-ms-filter: "progid:DXImageTransform.Microsoft.Matrix(@{nl} M11=@{cos},@{nl} M12=-@{sin},@{nl} M21=@{sin},@{nl} M22=@{cos},@{nl} sizingMethod='auto expand'@{nl} )";
}
Will produce this:
-webkit-transform: rotate(45deg);
-moz-transform: rotate(45deg);
-ms-transform: rotate(45deg);
-o-transform: rotate(45deg);
transform: rotate(45deg);
/* IE8- */
filter: progid:DXImageTransform.Microsoft.Matrix(
M11=0.7071067811865476,
M12=-0.7071067811865475,
M21=0.7071067811865475,
M22=0.7071067811865476,
sizingMethod='auto expand'
);
-ms-filter: "progid:DXImageTransform.Microsoft.Matrix(
M11=0.7071067811865476,
M12=-0.7071067811865475,
M21=0.7071067811865475,
M22=0.7071067811865476,
sizingMethod='auto expand'
)";
Based on a discovery for this question, you can do the input for the values on multiple lines if you split the escaped string up, like so:
filter: ~"progid:DXImageTransform.Microsoft.Matrix("
~"@{nl} M11=@{cos},"
~"@{nl} M12=-@{sin},"
~"@{nl} M21=@{sin},"
~"@{nl} M22=@{cos},"
~"@{nl} sizingMethod='auto expand'"
~"@{nl} )";