Compile LESS CSS Files with the LESS App

By  on  
LESS CSS

Last week I showed you how you can easily create your own Dijit theme with LESS CSS.  The process of creating LESS files is simple, as is compilation of said files, but I was frequently forgetting to compile the .less files before checking the style changes in the browser.  When I did have the sense to compile, I found myself completely annoyed at having to run the same command over and over.  Enter LESS.app:  a Mac app which allows you to add folders containing .less files and automatically compiles them when a file is saved!

After downloading and opening the app, the first step is dragging the "davidwalsh" theme directory into the app's left drawer:

LESS CSS Files

LESS.app will scan the directly and list each .less file.  You can click the checkbox to the right of the file to instruct Less.app to minify the CSS output, which is especially helpful when getting your CSS ready for production.

Once all of the .less files you want compiled appear within the list, switch to the Compiler tab and click the "Compile All" button:

LESS CSS Compile

LESS.app will then compile each desired .less file into a working .css file, minified if you had so chosen.  The compiler will spit back a success or failure message at the end of each compilation.  One last feature I will point out is the "Automatically compile files when saved" feature, which compiles your .less files when any of them is saved.  This awesome feature is great for people like myself who frequently change and refresh.

LESS CSS Compiled

If you're frequently working with LESS CSS, you really must get LESS.app.  The "compile when saved" and CSS minification features make LESS.app a huge time-saving utility.

Recent Features

  • By
    CSS @supports

    Feature detection via JavaScript is a client side best practice and for all the right reasons, but unfortunately that same functionality hasn't been available within CSS.  What we end up doing is repeating the same properties multiple times with each browser prefix.  Yuck.  Another thing we...

  • By
    Write Simple, Elegant and Maintainable Media Queries with Sass

    I spent a few months experimenting with different approaches for writing simple, elegant and maintainable media queries with Sass. Each solution had something that I really liked, but I couldn't find one that covered everything I needed to do, so I ventured into creating my...

Incredible Demos

  • By
    Xbox Live Gamer API

    My sharpshooter status aside, I've always been surprised upset that Microsoft has never provided an API for the vast amount of information about users, the games they play, and statistics within the games. Namely, I'd like to publicly shame every n00b I've baptized with my...

  • By
    CSS Gradients

    With CSS border-radius, I showed you how CSS can bridge the gap between design and development by adding rounded corners to elements.  CSS gradients are another step in that direction.  Now that CSS gradients are supported in Internet Explorer 8+, Firefox, Safari, and Chrome...

Discussion

  1. When using multiple files, you can @import "your.less"; files, then only need to compile the main file with minifying.

    You work with multiple LESS files, making development easier, but compile into one minified CSS file. Perfect. :)

  2. Rasmus Fløe

    I love LESS too :)

    Less app makes it a breeze on a mac.

    When working on Windows you’ll have to jump through a couple of hoops to get automatic LESS compilation up and running (no Less app). I found some good stuff on Duncan Smart’s blog: http://blog.dotsmart.net/2010/11/26/running-the-less-js-command-line-compiler-on-windows/

    Coupled with something called “File Watcher Simple” off of sourceforge I got a pretty sweet working solution – not as sexy as Less app though :D

  3. Argh! I wish there was a Micro$haft equivalent for those of us who need to get our corporate on. This would be perfect for me, since the command line scares me, but the only Apple product I own in an iPhone.

  4. Johan Tell

    Don’t forget the lessCSS for php parser that compiles, minifies and caches less files on the fly! Check it out! :)

  5. Less CSS, i love it makes life so much easier

  6. I prefer SASS over LESS. Mainly because I started on it and now it just feels second nature to me.

  7. I don´t the idea of coupling the layout with JavaScript. This App is great and integrates seemlessly into the workflow. Create your LESS-file, edit ist, save, and that´s it.
    So, the only thing you have to do is specifying the destination of the compilation process. From this point it feels like editing the CSS directly. With one exception: you cann use all the awesome LESS-features.

    Cool app, cool post!

  8. Joel

    A very interesting approach to handling the pain of maintaining CSS files. Nice work!
    Going to give it a try on my next project. Thank you for developing this great tool.

  9. Filip Van Tendeloo

    Just wanted to let you know that I just released an Adobe Air version of the Less Parser application. It is still in beta though:

    http://www.proving-ground.be/less/

  10. Paul Schlereth

    I’ve been trying to compile from one central css file with other files @imported and it won’t work. Before I pull the rest of my hair out, can anyone shed some light on why this might not work? I’ve tried two types of @import declarations and neither work. Here is a code sample:

    //reset
    @import url("normalize.less");
    
    // grid system & page structure
    @import url("layout.less");
    @import url("12columnGrid.less");
    
    // base css
    @import url("type.less");
    @import url("forms.less");
    @import url("tables.less");
    

    I also tried in the format:

    @import "normalize.css";
    

    HELP!! Thanks in advance!

  11. Paul Schlereth

    Crap. Forgot the code tags. Here’s the sample once more:

    //reset
    @import url("normalize.less");
    
    // grid system & page structure
    @import url("layout.less");
    @import url("12columnGrid.less");
    
    // base css
    @import url("type.less");
    @import url("forms.less");
    @import url("tables.less");
    
    //END of first sample
    
    //I also tried:
    @import "normalize.css";
    
  12. Paul Schlereth

    nevermind. figured it out!

    • Cyrylski

      Man, please tell us how. I still have this problem on Windows. Can only import a single file, more than one makes the LESS stop compiling to CSS…

Wrap your code in <pre class="{language}"></pre> tags, link to a GitHub gist, JSFiddle fiddle, or CodePen pen to embed!