Less.js does not have a 'toCSS' method on the clock

I use less.js (version 1.2.1) on localhost (on Windows), and when I use less.watch()the console, I keep getting this error:

less.js:9 Uncaught TypeError: Object #<HTMLLinkElement> has no method 'toCSS'

I was looking for an answer to solve this, but no luck. In any case, how to fix this error? The less.watch () function works, but it is also slow, and every second I get this error.

Anyway, to fix it?

There really is nothing in html, that’s how I configured 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)
+5
source share
1 answer

The Dev version is at https://github.com/cloudhead/less.js/blob/master/dist/less-1.2.1.js

Relevant Section:

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 section:

if (root) {
    createCSS(root.toCSS(), sheet, env.lastModified);
}

Edit:

if (root) {

at

if (root && sheet) {

then override (if desired) and use the new file.

+4
source

All Articles