tags:

views:

280

answers:

2

I have recently come across the LESS Leaner CSS a template engine for CSS based on ruby. The idea sounded neat, but in practice we need to compile the program to get CSS. This is cumbersome as we make too many changes while working on CSS and for every edit we don't want to compile.

In Eclipse, there are "Save-Actions" but it handles only formatting changes.

Is there a way on saving the file in Eclipse, to call or trigger the compilation?

Its easy to do this in Vi or Emacs.

+5  A: 

I think all you need is to define a custom Builder for your project. That way, you can run a program or an ant script whenever certain files change.

Right click on the project -> Properties -> Builders -> New

Michael Borgwardt
Perfect. Never used this feature.
lud0h
I also only learned about it recently
Michael Borgwardt
+5  A: 

While the Builders are a good solution, keep in mind they only work when a build is issued - either using auto-build or using a manual build which is invoked, well, manually. If you are looking for something that will operate after a save, regardless of the auto-build state you will need to write a plugin which listens to resource changes in Eclipse.

You do that by creating a workspace change listener and installing it like that:

ResourcesPlugin.getWorkspace().addResourceChangeListener(
..., IResourceChangeEvent.POST_CHANGE);

I'm sure you can take it from here :-)

zvikico