A
A
Alexander2015-12-18 02:15:01
css
Alexander, 2015-12-18 02:15:01

Why doesn't less.js recompile styles?

For development, I always need styles with all the latest changes, so when development mode is enabled, the direct file less and the less.js script are connected.
However, once it has collected the styles, for some reason it does not update them. Whatever changes I make - in the browser I have the very first version. It looks like less.js caches them somewhere on the browser side. How to force it to clear this cache?
Those. I noticed that if there are changes directly in the file that is connected, the styles are updated. But they are not updated if the changes affect only the files that are included in the connected one. I don't need this optimization.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
C
Cat Anton, 2015-12-18
Madzhugin @Suntechnic

Try including less like this:

<script type="text/javascript">
    var less = less || {}; less.env = 'development';
</script>
<script src="less.js"></script>

Or disable caching in the browser (chrome): If you use grunt / gulp for building, then there is a great watch plugin ( grunt / gulp ) that can automatically rebuild css when any less file changes. And if you also install a browser extension, then the page itself will be updated .

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question