less.js lazy sheet load

前端 未结 6 1151
天涯浪人
天涯浪人 2021-02-06 00:07

I\'m wondering if there is a way to load a single less sheet sometime after a page load. This question has an answer that explains how to reload all the sheets, but for my use-

6条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-02-06 00:30

    You can use this lightweight library to lazy load less / css and js files ( disclaimer: i am the author).

    This is as simple as:

    lazy.load('/static/less/style.less');
    

    It can also receive a callback, load some more assets with dependencies and takes care about cache.

提交回复
热议问题