Eclipse: On Save execute a program

后端 未结 2 1623
傲寒
傲寒 2020-12-15 05:33

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. Th

相关标签:
2条回答
  • 2020-12-15 06:05

    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 :-)

    0 讨论(0)
  • 2020-12-15 06:09

    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

    0 讨论(0)
提交回复
热议问题