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 Animations Between Media Queries

    CSS animations are right up there with sliced bread. CSS animations are efficient because they can be hardware accelerated, they require no JavaScript overhead, and they are composed of very little CSS code. Quite often we add CSS transforms to elements via CSS during...

  • By
    Creating Scrolling Parallax Effects with CSS

    Introduction For quite a long time now websites with the so called "parallax" effect have been really popular. In case you have not heard of this effect, it basically includes different layers of images that are moving in different directions or with different speed. This leads to a...

Incredible Demos

  • By
    5 More HTML5 APIs You Didn’t Know Existed

    The HTML5 revolution has provided us some awesome JavaScript and HTML APIs.  Some are APIs we knew we've needed for years, others are cutting edge mobile and desktop helpers.  Regardless of API strength or purpose, anything to help us better do our job is a...

  • By
    MooTools Equal Heights Plugin:  Equalizer

    Keeping equal heights between elements within the same container can be hugely important for the sake of a pretty page. Unfortunately sometimes keeping columns the same height can't be done with CSS -- you need a little help from your JavaScript friends. Well...now you're...

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!