Book Image

Learning less.js

Book Image

Learning less.js

Overview of this book

Table of Contents (22 chapters)
Learning Less.js
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Using the command-line compiler


So far, we've used a standalone editor to compile (or Crunch!—pun intended!) our code. It has successfully produced some valid CSS for us, which can be used in a normal HTML page if desired. This works well, but might not be the preferred choice for everyone!

Instead of having to use a standalone compiler, we can achieve the same result by using the command line instead. Granted that this is a little bit more of a manual process, but it does give us the opportunity to hook in the compilation process as a command that we can run directly from most text editors.

Compiling Less files using the command line

The process to compile Less files via the command line is very easy. Start by bringing up a command prompt and changing the location to your project folder, which is the lessjs folder we created earlier. At the command prompt, type in the following command and then press Enter:

lessc variables.less variables.css

That's all that is required for a basic compilation...