admin管理员组

文章数量:1323354

I'm building a simple web application that needs to pile a LESS file into CSS file on the fly.

I want to call a few JavaScript functions after less.js plete the render of style.less file.

I found the following code in a thread, but nothing working for me:

<link rel="stylesheet/less" type="text/css" href="less/style.less">
<script type="text/javascript" src="js/less.min.js"></script>
<script>
less.hasFinished.then(
    function() {
        console.log('pleted');
    }
);
</script>

Also tried few other things:

<link rel="stylesheet/less" type="text/css" href="less/style.less">
<script type="text/javascript" src="js/less.min.js"></script>
<script>
less = {
    postProcessor: function(css) {
        console.log('plete');
    }
};
</script>

Is there any less.onComplete() callback function or something similar??

I'm building a simple web application that needs to pile a LESS file into CSS file on the fly.

I want to call a few JavaScript functions after less.js plete the render of style.less file.

I found the following code in a thread, but nothing working for me:

<link rel="stylesheet/less" type="text/css" href="less/style.less">
<script type="text/javascript" src="js/less.min.js"></script>
<script>
less.hasFinished.then(
    function() {
        console.log('pleted');
    }
);
</script>

Also tried few other things:

<link rel="stylesheet/less" type="text/css" href="less/style.less">
<script type="text/javascript" src="js/less.min.js"></script>
<script>
less = {
    postProcessor: function(css) {
        console.log('plete');
    }
};
</script>

Is there any less.onComplete() callback function or something similar??

Share Improve this question edited Jul 30, 2021 at 15:15 TylerH 21.1k77 gold badges79 silver badges112 bronze badges asked Dec 23, 2014 at 9:31 NehalNehal 1,0221 gold badge10 silver badges33 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 14

Try pageLoadFinished

<script>
less.pageLoadFinished.then(
    function() {
        console.log('pleted');
    }
);
</script>

本文标签: javascriptWhat is the lessjs complete event callbackStack Overflow