Tag Archives: css

How to enable syntax highlighting for LESS in Notepad++

After doing a fair bit of searching over several days, I found a way to enable syntax highlighting for the LESS CSS programming language in my text editor of choice, Notepad++. The real key here was finding this page, which lists countless user-defined language files for Notepad++. From there, you can download the LESS.js file. It is an XML file. Once you’ve downloaded that, simply open up Notepad++, go into the View menu,  then click User-Defined Dialogue. That will make a dialogue box pop up. Toward the top of the box, there’s a button that says Import… click it and select the LESS XML file that you downloaded. Close the window, and go to a .less file. Go into the Languages menu, and you should see LESS at the bottom of the list.  After you click on it, the .less file you have open should show proper syntax highlighting.

One issue I ran into with this is that the LESS escape character, ~ is not included in the language file download. Luckily, this is easy to fix by returning to the User-Defined Dialogue box. In the dialogue box, underneath the Operators tab, check the box that says “Enable escape character”, and type “~” into the adjacent text box. Voila!

One other thing: since this is a user defined language, if you are using a style other than the default style in Notepad++, the highlighting will look strange; all the text will be highlighted in white (it looks weird against a black background). I haven’t found a way around this yet, and am just using the Default Notepad++ style when I’m working on .less files.


Posted by on July 7, 2011 in Programming, Software, Uncategorized


Tags: , , , ,