Clearing LESS Cache for Development

If you’re developing with Twitter Bootstrap (LESS), you may notice that sometimes changes you make in your .less files do not take effect (this is under the assumption you’re not compiling your CSS with a tool like CodeKit).  Clearing your browser cache does nothing and uploading new files doesn’t help.  We started using a quick little snippet (we love snippets) to stop this problem:

<script type="text/javascript"> localStorage.clear();</script>

As you can probably tell, this line clears localStorage – a component of HTML5.  Use this throughout development, and make sure you compile your CSS once you’re ready to push a production site live!