Home  >  Article  >  Web Front-end  >  How to Dynamically Load LESS Rules After Page Load?

How to Dynamically Load LESS Rules After Page Load?

Mary-Kate Olsen
Mary-Kate OlsenOriginal
2024-10-24 18:33:17890browse

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