Lesscss compatibility

289 views
Skip to first unread message

Mehdi Salem Naraghi

unread,
Mar 9, 2012, 3:45:22 PM3/9/12
to selectivizr
Hi,
I can't get selectivizr to work with lesscss. Am I doing something
wrong or is lesscss not supported yet?

I have tested the following html file:

<!DOCTYPE html>
<html>
<head>
<title>test</title>

<link type="text/css" rel="stylesheet" href="../css/test.css" />
<link type="text/less" rel="stylesheet" href="../css/test.less" />

<script src="../js/less-1.2.2.min.js"></script>
<script src="../js/nwmatcher-1.2.5.js"></script> <!-- used by
selectivizr until jquery implements all CSS3 selectors -->
<script src="../js/selectivizr-1.0.2.min.js"></script> <!--
gives us CSS3 selector support -->
</head>

<body>
<ul>
<li>first</li>
<li>second</li>
<li>third</li>
<li>fourth</li>
<li>fifth</li>
</ul>

<ol>
<li>first</li>
<li>second</li>
<li>third</li>
<li>fourth</li>
<li>fifth</li>
</ol>
</body>
</html>

with these two stylesheets

CSS:
ul li:first-child {
color: red;
}

ul li:last-child {
color: green;
}

ul li:nth-child(2n + 1) {
background-color: rgb(240,240,240);
}

LESS:
ol {
li {
&:first-child { color: red; }
&:last-child {color: red; }
&:nth-child(2n+1) { background-color: rgb(240,240,240); }
}
}

Thanks in advance
Mehdi S.

connexo

unread,
May 8, 2012, 12:17:09 PM5/8/12
to selectivizr
Hey Mehdi,

afaik ist has to be

<link type="text/css" rel="stylesheet/less" href="../css/test.less" />

instead of

<link type="text/less" rel="stylesheet" href="../css/test.less" />

Also, you omit the type of your scripts (type="text/javascript").

Hope it helps.

Regards,

Frank

Francesco Spreafico

unread,
May 8, 2012, 3:28:43 PM5/8/12
to ie-...@googlegroups.com
On Tue, May 8, 2012 at 6:17 PM, connexo <frank...@googlemail.com> wrote:

> Also, you omit the type of your scripts (type="text/javascript").

That is not necessary in HTML5 and it's better not to use it (simply
because it's useless and doesn't add any information).

The same for the stylesheet, when the type is "text/css" (so not in
case of LESS).

I think this doesn't work because it's client-side LESS and I don't
see on the site that it's supported.

Best,
Francesco
Reply all
Reply to author
Forward
0 new messages