27

I want to have files with a .less extension use the CSS syntax highlighting in NetBeans, and I don't have any clue how to do this.

I found a rather time consuming way to do this (http://netbeans.dzone.com/tips/quickstart-guide-language-supp), but it hit me that it must be easier way to do this.

Anyone knows?

Rasmus
  • 4,190
  • 7
  • 22
  • 32
  • 1
    Note that since Netbeans 8.0 LESS support is present in the IDE by default, no more need for plugins. And it works great! – Pevara May 09 '14 at 22:59

5 Answers5

23

You just have to add a new file type in Netbeans > Tools > Options > Miscellaneous > Files. Note that Netbeans will mark as errors some less features like variables...etc

Maxence
  • 12,868
  • 5
  • 57
  • 69
  • 2
    Thank you! It works perfectly, well except for that already mentioned, but I can live with that. Seems I just missed that, must get glasses or something. – Rasmus Jul 19 '10 at 02:23
  • This method is far better than the LessCSS plugin as it's a bit buggy and does not support code completion and auto-indentation, which is absolutely vital if you write lots of CSS. – Nick Aug 21 '12 at 10:36
  • this is the correct answer for me, I don't think there is any need for a plugin. just define a new extension and use text/css highlighting. like someone mentioned in this link: http://andygroff.com/2010/10/netbeans-6-9-custom-syntax-highlighting/comment-page-1/ – kubilay Mar 10 '13 at 15:39
  • Strange, I don't have any MIME types to choose from. What's up with my Netbeans installation? 7.3.1 on Win7-64. http://i.imgur.com/BtIrYae.png – Mateng Jan 24 '14 at 12:00
11

a module which adds full less highlighting support can be downloaded from the following page: http://plugins.netbeans.org/plugin/32782/lesscss-module

i tested the module with netbeans 7.0 and it worked flawless.

c33s
  • 2,612
  • 1
  • 30
  • 43
  • It doesn't work that well in 6.9.1, some short cuts break and the * key doesn't seem to work. – Paul Sheldrake Sep 02 '11 at 10:41
  • Doesn't work well in 7.0.1 either. No completion, highlighting is partially broken. – glebtv Sep 23 '11 at 04:41
  • for me it still "works", if i write for example: "test: xxx" the xxx is displayed wrong. you only see the rectangle of a missing symboyl, but if you don't bother and just finish writing and end with a ";" the wrong symbol changes back to normal. quite unhandy but it better than no highlighting – c33s Sep 23 '11 at 06:49
  • 4
    "Flawless" is an euphemism here, as one hasn't full CSS/LESS snytax highlighting, no auto-completing for CSS, no syntax error-highlighting, … – feeela Jan 23 '13 at 13:44
  • I works in 7.4 same as feeela said you don't have the "errors" you see in css but you wont get anything else – open-ecommerce.org Nov 11 '13 at 12:03
6

You might try out the new version of the plugin that was already mentioned:
http://plugins.netbeans.org/plugin/41315/lesscss-module

GitHub repository, now gone, was available at:
https://github.com/khairie/lesscss-module

For me it seems to work quite fine despite some minor bugs in coloring. It is missing some features and e.g. does not offer automatic formatting, though.

Note that basic editing support for Sassy CSS and LESS CSS preprocessor files has been added to NetBeans dev build:
http://wiki.netbeans.org/NewAndNoteWorthy

Hermes
  • 756
  • 7
  • 10
  • For me works in 7.3 beta too. Github repository is gone, but some forks left. However often crashes. – kolen Nov 20 '12 at 06:41
3

The SCSS Support plugin also works with less files, just need to add the "less" file extension with text/x-scss MIME in Tools/Options/Miscellaneous/Files.

István Ujj-Mészáros
  • 3,228
  • 1
  • 27
  • 46
1

Since Netbeans 7.4 less is supported by Netbeans without the need for an additional plugin.

For older version of Netbeans there are two plugins: http://plugins.netbeans.org/plugin/32782/lesscss-module and http://plugins.netbeans.org/plugin/41315/lesscss-module

R. Oosterholt
  • 7,720
  • 2
  • 53
  • 77