Resource interpreted as Script but transferred wit

2019-02-17 08:40发布

LESS beginner.

Wrote a test html below

<head>
    <link rel="stylesheet" type="text/css" href="404.less">
    <script src="http://lesscss.googlecode.com/files/less-1.3.0.min.js" type="text/javascript"></script>
</head>
<body>test</body>

But got a warning in Chrome

Resource interpreted as Script but transferred with MIME type text/x-c++: "http://lesscss.googlecode.com/files/less-1.3.0.min.js".

Why?

标签: css less
2条回答
时光不老,我们不散
2楼-- · 2019-02-17 09:09

You probably want your link tag to say:

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

That said, if this is being served from a webserver it could be that that's detecting the mime type wrong from the file extension. If it's an apache server though, there's an easy fix. Add this to/create a .htaccess file in your webroot, containing the line:

AddType text/css less 
查看更多
ら.Afraid
3楼-- · 2019-02-17 09:15

I had a similar issue with twitter follow-me buttons when I was reviewing local html files in chrome. To fix this I just fired up web matrix 2.0 and pointed at my folder. Hope this helps.

查看更多
登录 后发表回答