I am using less.js (version 1.2.1) on localhost (on Windows), and when I use less.watch()
in console, I keep getting this error:
less.js:9 Uncaught TypeError: Object #<HTMLLinkElement> has no method 'toCSS'
I searched for an answer to solve this, but no luck. Anyway on how to fix this error? The less.watch() does work, but it also is slow and every second I get that error.
Anyway to fix this?
There is really nothing in the html, here is how I set up less though. Am I doing it wrong?
<link rel="stylesheet/less" type="text/css" href="css/styles.less">
<script src="js/less.js" type="text/javascript"></script>
Firebug Console:
b.toCSS is not a function
[Break On This Error]
b && r(b.toCSS(), d, e.lastModified)
Dev version is at https://github.com/cloudhead/less.js/blob/master/dist/less-1.2.1.js
The relevant section is:
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;
}
In the section:
if (root) {
createCSS(root.toCSS(), sheet, env.lastModified);
}
Change:
if (root) {
to:
if (root && sheet) {
then re-minify (if desired) and use the new file.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With