Friday, January 6, 2012

Adding Less encoding to Sublime Text 2

Since Less is a superset of css, you can get sublime to use the CSS module for your less files. You only need to modify one little file.

Open the CSS.tmLanguage file in ST. On a mac, it's located in ~/Library/Application Support/Sublime Text 2/Packages/CSS.

Look for this part of the file

<dict>
  <key>fileTypes</key>
  <array>
    <string>css</string>
    <string>css.erb</string>
    <string>less</string> <- add this line
  </array>
...
</dic>

Once you do that, when you open a .less file, you'll get pretty good color coding and all of the normal css sippets. Of course you won't get support for the less additions to css because that would require some actual work. You'll still get about 80% coverage.