Automatically Compiling SASS in Eclipse

We have been working SASS for some time and used to compile it using ‘watch’ option. It is not an ideal solution to run a daemon to monitor your sass/scss files. As we are working on Eclipse, why not leverage it to automate without use of the watch 🙂

Please read requirements section below to execute the process succesfully.

Builders in Eclipse

Eclipse has an option called Builders. Right Click on your Project -> Properties

Eclipse-Builder

 

Builder provides mechanism to allow compiling the code whenever required. Now in our case it is SASS and no builder is available for it.

How to solve this?

Simple!! Add a builder for your project.

Right Click Project -> Properties -> Builder -> Click ‘New’

Add-builder

Add External Program and set the settings similar to this (bear in mind this is for Linux, as I use Linux for development)

Sass-builder

Basically it is the command used to compile the SCSS/SASS file to CSS.

sass application/scss/app.scss:css/app.css

Set it to build with other files at various build options from the “Build Options” tab in Builder Configurations popup

Sass-Auto-build-options

That’s It. You are ready to use auto compiling SASS in Eclipse environment without watch.

 

What will happen if there is an error?

Error will flash in the console like in the screenshot below

Sass-error