Our team is starting to use LESS to write CSS. I am using atom.io and there is a plugin to auto-compile LESS to CSS on save. (Link to plugin) However, some team member prefer to use sublime. While there are also similar plugin for sublime, it requires npm for installation. Our team mainly use PHP with composer for package management, so installing npm just for a plugin seems a bit overkill. Is there any other way to do LESS auto-compile on save with sublime?
-
If you don't care, I recommend to use the WinLess application if you're on Windows, I know that this not related to Sublime, but it may help ya. It auto compiles your Less files when they're saved – while it's running (if you haven't disabled its auto-compile option) and is very easy to use. http://winless.org You can use SimpLESS in Mac: https://wearekiss.com/simpless – Oct 20 '16 at 21:51
2 Answers
Not that I know... :(
There is a python
library that compiles less
to css
. (sublime plugin are written in python) though
So, all you've got to do is: write this plugin using lesspy
If you are a bit patient, I am trying to make this plugin, it shouldn't be to hard, I'll keep you in touch.
Matt
EDIT: Here's the plugin: st-py-less. Follow the (simple) instructions to install it. Only working with Sublime Text 3.

- 4,167
- 24
- 35
-
-
Thanks (and upvote), too bad we got member using Sublime Text 2 as well.... – cytsunny Oct 24 '16 at 10:46
They could probably use SublimeOnSaveBuild
But npm and Composer aren't really comparable here. Composer manages a project's dependencies, npm provides easy access to hundreds of thousands of community-maintained packages. Using Composer isn't a reason to not install npm.
And the package you install when you "install npm" is under 14MB. It also comes included with Node.js. The "Installation Requirements" for sublime-less2css, by listing "install node" and "install npm" as two separate steps are misleading, and the provided links aren't that helpful. Here's the official documentation for Installing Node.js and updating npm
This is getting beyond the scope of your question, but to have a single team-wide editor-agnostic setup for automatically compiling LESS to CSS you could use Gulp. If you aren't familiar with Gulp, follow CSS-Tricks' Gulp for Beginners from the start up through the "Watching Sass files for changes" step. (Note that the guide teaches you how to use gulp-sass
to compile Sass to CSS; in your case you'd just use gulp-less
instead.)

- 4,244
- 2
- 26
- 37
-
Thank you for your answer and that SublimeOnSaveBuild is interesting, but It is not just the storage space for installing node.js. Actually we tried to install node.js but somehow the installation get error, and we already got a php compiler for LESS. The only problem is that you need to run a command instead of automatically compile on save. So, to be exact, we feel that it is overkill to resolve the error for a tool that is just doing one simple function. – cytsunny Oct 20 '16 at 03:08
-
Fair enough. Let us know if SublimeOnSaveBuild works for you - it should do the job of autocompiling LESS in Sublime Text – henry Oct 20 '16 at 19:39