

For the fastest performance possible for a static web site, we recommend compiling Less on the server side. Also, sometimes cosmetic issues can occur if a JavaScript error occurs. While it is possible to use Less on the client side in production, please be aware that there are performance implications for doing so (although the latest releases of Less are quite a bit faster). Less.js supports all modern browsers (recent versions of Chrome, Firefox, Safari, and Edge). Or for brevity they can be set as attributes on the script and link tags: Browser Support The other way is to specify the options on the script tag, e.g. You can set options either programmatically, by setting them on a less object before the script tag - this then affects all initial link tags and programmatic usage of less. Next, download less.js and include it in a tag in the element of your page: Setting Options less stylesheets with the rel attribute set to " stylesheet/less": Using Less.js in the browser is the easiest way to get started and convenient for developing with Less, but in production, when performance and reliability is important, we recommend pre-compiling using Node.js or one of the many third party tools available. To use clean css with lessc, use the clean css plugin.Įdit the markdown source for "using-less-in-the-browser" In v2 of less, Clean CSS is no longer included as a direct dependency. Outputs a makefile import dependency list to stdout. Prints a help message with available options and exits. ExamplesĬompile bootstrap.less to bootstrap.css lessc bootstrap.less bootstrap.cssįor all other options, see Less Options. If source is set to `-' (dash or hyphen-minus), input is read from stdin. The binary included in this repository, bin/lessc works with Node.js on *nix, OS X and Windows. Since patch releases are non-breaking we will publish patch releases immediately and alpha/beta/candidate versions will be published as minor or major version upgrades (we endeavour since 1.4.0 to follow semantic versioning). These builds will not be published as a official release, and will typically have beta in the version (use lessc -v to get current version). Periodically, as new functionality is being developed, lessc builds will be published to npm, tagged as beta. This will install the latest official version of lessc in your project folder, also adding it to the devDependencies in your project's package.json. Installing for Node DevelopmentĪlternatively, if you don't want to use the compiler globally, you may be after npm i less -save-dev For a specific version (or tag) you can add after our package name, e.g. The -g option installs the lessc command available globally. Heads up! If the command line isn't your thing, learn more about GUIs for Less. Edit the markdown source for "command-line-usage"Ĭompile.
