There have been a bit of talk about issues with cssless and font-face already, for example here: How we can use @font-face in Less
But this problem seems to be a different one, and I wonder whether anyone has found workaround to this? I think my less syntax is right though.
If I write the following:
.setFont (@fontName) {
@font-face {
font-family: '@{fontName}';
src: url('../fonts/@{fontName}.eot');
src: url('../fonts/@{fontName}.eot?#iefix') format('embedded-opentype'),
url('../fonts/@{fontName}.ttf') format('truetype');
}
}
.setFont ('myfont1');
.setFont ('myfont2');
.setFont ('myfont3');
It will output the following:
@font-face {
font-family: 'myfont1';
src: url('../fonts/myfont1.eot');
src: url('../fonts/myfont1.eot?#iefix') format('embedded-opentype'),
url('../fonts/myfont1.ttf') format('truetype');
}
@font-face {
font-family: 'myfont1';
src: url('../fonts/myfont1.eot');
src: url('../fonts/myfont1.eot?#iefix') format('embedded-opentype'),
url('../fonts/myfont1.ttf') format('truetype');
}
@font-face {
font-family: 'myfont1';
src: url('../fonts/myfont1.eot');
src: url('../fonts/myfont1.eot?#iefix') format('embedded-opentype'),
url('../fonts/myfont1.ttf') format('truetype');
}
It only takes the first variable. I wonder whether it is because they aren't called inside an element - though I did try to call it inside an element as well, with identical results.
How do you use cssless with font-face?
Thanks.