Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
391 views
in Technique[技术] by (71.8m points)

css - Can't get less.js to work

I can't get less.js to work and I have no idea why. Heres the HTML i tried:

<!DOCTYPE HTML>
<html lang="en">
    <head>
        <meta charset="utf-8" />

        <!-- CSS -->
        <link rel="stylesheet/less"  href="main.less" />

        <!-- Javascript -->
        <!-- <script src="http://lesscss.googlecode.com/files/less-1.0.18.min.js"></script> -->
        <script src="less-1.0.18.min.js" type="text/javascript"></script>

    </head>
    <body>
        <p>
            Lorum ipsum
        </p>
    </body>
</html>

And heres main.less:

p {
    color: blue;
}

The less-1.0.18.min.js file is downloaded from http://lesscss.googlecode.com/files/less-1.0.18.min.js. All files is in the same folder. I have no idea why this isn't working...

Tested in Chrome 12.0.742.100

Edit

Tried the lates less.js file (less-1.1.3.min.js). That one did also not work.

Okay now...

This works:

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

But only as normal css, no less specific markup.

This doesn't work at all:

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

Also, this isn't working:

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

What the hell? How do I get less to work?

Found the error

P.S.S. Less.js browser script currently won’t work if you’re using Chrome and the path to your page starts with “file:///” due to a known Chrome issue.

Soruce

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

P.S.S. Less.js browser script currently won’t work if you’re using Chrome and the path to your page starts with “file:///” due to a known Chrome issue.

But what we could do is setting up a local testing environment using wamp (pc) or mamap (mac). It will work alright then.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...