cYr*_*rus 17 html javascript css google-chrome less
看一下我写的官方网站上的快速入门:
less.html
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet/less" type="text/css" href="style.less" />
<script src="less-1.1.3.min.js" type="text/javascript"></script>
</head>
<body>
<h1>foo</h1>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
style.less
@color: red;
h1 {
color: @color;
}
Run Code Online (Sandbox Code Playgroud)
在本地,我得到的是(来自谷歌Chrome控制台):
XMLHttpRequest cannot load file:///home/cyrus/test/style.less. Cross origin requests are only supported for HTTP.
Uncaught Error: NETWORK_ERR: XMLHttpRequest Exception 101
r
o
n
d.refresh
(anonymous function)
(anonymous function)
解决方法:
$ google-chrome -allow-file-access-from-files
Run Code Online (Sandbox Code Playgroud)