How to Dynamically Load LESS Rules After Page Load?

Mary-Kate Olsen
Release: 2024-10-24 18:33:17
Original
826 people have browsed it

How to Dynamically Load LESS Rules After Page Load?

Loading LESS Rules Dynamically

Preexisting Limitations

LESS stylesheets, initially, must be loaded before the less.js script. This is because the script parses and interprets the LESS styles prior to rendering. Reversing this order would result in no style interpretation.

Dynamic Loading Solution

Version 1.0.31 of less.js introduces the less.refreshStyles() method. This method recompiles