Nowadays most of the applications are using SASS instead of CSS, because of its advantages. But it is more important that we need to compile the SASS into CSS. For SASS compilation, there might be lots of native applications & JAVA libraries available.
Both have some advantages & disadvantages like installation required ( in terms of native apps or JS watchers ) or no real-time compilation ( in terms of pure JAVA libraries ).
We all might be satisfied with the above mentioned ways of SASS compilation. But we can now able to do the same compilation with the help of a JAVA library & Event gateways using Lucee.
If you've enough knowledge to create an event gateway in Lucee, it is very simple work to make it working as a SASS compiler gateway. For that, you should have the same list of files as we seen in How to create event gateway in Lucee.
Additionally we need to add the below code in listener component's checkChange function. This is the essential part of compiling the sass file into a css file.
As we changed the listener function name & used the JSass java library, we should make the necessary changes like changing the listener CFC path in driver component & place the JSass library in corresponding folders.
Once you've done with creating the new instance for this event gateway, if there is any file change happened in the folder mentioned, the SCSS will be automatically converted into CSS.