All the .js files on the site are included using require.js. How can I include less.js using require.js as well? When I include it using tag script it doesn't work less.
There is a require-less plugin for require
https://github.com/guybedford/require-less
You probably shouldn't do that. You always put your CSS at the very top of your HTML document, as high as it can go, that's a given. When you use LESS instead of CSS, put both the LESS file and the LESS.js file as high up as you can on the document. That's right, using LESS in the browser means you have 2 files that you need to serve before the page loads.
There are probably ways around it, such as packaging your CSS inside your LESS file as a variable, but that's sloppy and difficult. If performance means that much to you, you should think about where you compile your LESS files.
Compile at development time with a desktop app like Less Parser (cross-platform) or Less.App (mac) (and there are a few more). These programs run in the background and compile your less files every time you save them.
Compile at build time if you have a build step in Ant or Maven with Asual's LESS Jar (github).
Compile on the server if you have .NET or IIS (dotlesscss.org), php (leafo.com/lessphp), NodeJS, Java (less rhino), ColdFusion, etc etc. Just search github.com for all of the code.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With