我在localhost(在Windows上)使用less.js(版本1.2.1),当我less.watch()在控制台中使用时,我不断收到此错误:
less.js:9 Uncaught TypeError: Object #<HTMLLinkElement> has no method 'toCSS'
Run Code Online (Sandbox Code Playgroud)
我找到了解决这个问题的答案,但没有运气.无论如何修复此错误?less.watch()确实有效,但它也很慢,每一秒我都会遇到这个错误.
有任何解决这个问题的方法吗?
html中确实没有任何内容,这里是我如何设置更少.我做错了吗?
<link rel="stylesheet/less" type="text/css" href="css/styles.less">
<script src="js/less.js" type="text/javascript"></script>
Run Code Online (Sandbox Code Playgroud)
Firebug控制台:
b.toCSS is not a function
[Break On This Error]
b && r(b.toCSS(), d, e.lastModified)
Run Code Online (Sandbox Code Playgroud)
开发版本位于https://github.com/cloudhead/less.js/blob/master/dist/less-1.2.1.js
相关部分是:
if (less.env === 'development') {
less.optimization = 0;
if (/!watch/.test(location.hash)) {
less.watch();
}
less.watchTimer = setInterval(function () {
if (less.watchMode) {
loadStyleSheets(function (e, root, _, sheet, env) {
if (root) {
createCSS(root.toCSS(), sheet, env.lastModified);
}
});
}
}, less.poll);
} else {
less.optimization = 3;
}
Run Code Online (Sandbox Code Playgroud)
在本节中:
if (root) {
createCSS(root.toCSS(), sheet, env.lastModified);
}
Run Code Online (Sandbox Code Playgroud)
改变:
if (root) {
Run Code Online (Sandbox Code Playgroud)
到:
if (root && sheet) {
Run Code Online (Sandbox Code Playgroud)
然后重新缩小(如果需要)并使用新文件。
| 归档时间: |
|
| 查看次数: |
1733 次 |
| 最近记录: |