Below is a Intellij FileWatcher template for automatically compiling a custom theme’s style.css from scss sources.
We find that our developers prefer (for speed reasons) to manually compile the custom theme’s styles.css file locally once when
changes are made rather than the in browser compilation (since the in-browser compilation adds about 1.5 seconds to every page refresh).
We have been using Vaadin’s SassCompiler class to do that. Intellij recently introduced the FileWatcher plugin that support running a task when changes to a file and its “children” are made.
With the plugin installed and the file below added to the .idea/ directory, now the various scss files are compiled on the fly, even as you type (if Intellij detects no SCSS syntax errors).
To use it just replace the jar paths and jdk path (after installing the plugin).
The main downside is needing to hardcode the jar version, which I haven’t yet found a way around.
Enjoy!
P.S. Does anyone knows of a similar sharable Eclipse solution?
.idea/watcherTasks.xml:
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectTasksOptions">
<TaskOptions isEnabled="true">
<option name="arguments" value="-cp C:\Tetris\repository\com\vaadin\vaadin-theme-compiler\7.0.4\vaadin-theme-compiler-7.0.4.jar;C:\Tetris\repository\org\w3c\css\sac\1.3\sac-1.3.jar;C:\Tetris\repository\com\vaadin\vaadin-shared-deps\1.0.2\vaadin-shared-deps-1.0.2.jar com.vaadin.sass.SassCompiler styles.scss styles.css" />
<option name="checkSyntaxErrors" value="true" />
<option name="description" value="Compiles .scss files into .css files" />
<option name="exitCodeBehavior" value="ERROR" />
<option name="fileExtension" value="scss" />
<option name="immediateSync" value="true" />
<option name="name" value="SCSS" />
<option name="output" value="styles.css" />
<option name="outputFilters">
<array />
</option>
<option name="outputFromStdout" value="false" />
<option name="passParentEnvs" value="true" />
<option name="program" value="C:\Tetris\operations\programs\java\jdk1.6.0_37\bin\java.exe" />
<option name="scopeName" value="Project Files" />
<option name="trackOnlyRoot" value="true" />
<option name="workingDir" value="$FileDir$" />
<envs />
</TaskOptions>
</component>
</project>