is a simple Gentoo Linux service / initscript for automatic background compiling of Sass files. Once installed and started on a Gentoo Linux system, sasswatch monitors the project specific files and folders you configured, tracks changes in Sass files and silently compiles them to CSS in real-time.
sasswatch works completely silent on the server and doesn't require you to do anything special while working on your Sass files. Just save your files and they will be compiled automagically. You do neither have to invoke Sass compilation manually, nor do you have to care about the service itself. No installation or configuration is required on the client side (i.e. your editor or IDE).
Download and extract (or clone) the GitHub repository to your Gentoo box. Merge the contents of the
etc folder to the corresponding locations on your system. You should have
/etc/init.d/sasswatch start /etc/init.d/sasswatch stop /etc/init.d/sasswatch restart
If you want the sasswatch service to start on system startup, just include the service into your default runlevel:
rc-update add sasswatch default
Whenever you modify any of the configuration files (global or project), the service needs to be restarted (there's no "graceful" reloading at the moment).
See below for some prerequisites for running sasswatch on your box.
The global configuration file
/etc/conf.d/sasswatch holds the default options for any watcher sasswatch will start. There are three variables to define here:
Whether to automatically load the compass library ("0" or "1"). Defaults to "1" if you don't specify anything here.
Default Sass output style. Defaults to "expanded" if you don't specify anything here. Valid options are "nested", "expanded", "compact" and "compressed".
Determines the additional libraries that should be loaded. Separate several libraries with a space (e.g. "library1 library2"). Defaults to an empty string (no additional libraries are being loaded then).
Project configurations have to be located in the directory
/etc/sasswatch.d. You can have an arbitrary number of project configurations. Each of them will be read and used by a single
sass --watch process and may define up to 4 variables (see the example configuration for the exact format):
Same as the global SASSWATCH_COMPASS setting (see above), but on project level. Defaults to the global value if omitted.
Same as the global SASSWATCH_STYLE setting (see above), but on project level. Defaults to the global value if omitted.
Same as the global SASSWATCH_REQUIRE setting (see above), but on project level. Defaults to the global value if omitted.
This is the only mandatory variable that has to be defined in a project configuration. It sets the
input-folder:output-foldertuples that make up the compilation process. Any Sass file referenced as input file or contained in (or below) the input folder will be compiled to a CSS file at the corresponding output location.
You may specify an arbitrary number of compilation tuples. Put them all into the watch variable, ideally separated by a new line, e.g. like this:
To use sasswatch on your system, you must have Ruby, sass, GNU parallel and some additional libraries (like potentially compass) installed.
First off, get Ruby and put this into your
/etc/make.conf on older systems):
Next, emerge Ruby, sass and GNU parallel. On some systems some of the required packages might need the experimental keyword, so you might have to put something like this into your
dev-ruby/rb-inotify ~amd64 dev-ruby/listen ~amd64 dev-ruby/sass ~amd64
emerge ruby sass sys-process/parallel
There's no compass ebuild on Gentoo, so you will have to install it as Ruby Gem:
gem install compass
If you intend to use additional, external libraries, you will be on your own to install them appropriately.
Running under Hardened Gentoo
I had a hard time getting
sass --watch to run properly under Hardened Gentoo. At the time of this writing (January 31st, 2014), instead of using the gentoo ebuilds, this is the installation process I employed:
gem install sass gem install compass gem install --version '~> 0.9' rb-inotify paxctl -m /usr/bin/ruby
In particular the last line is somewhat of a last ressort, but I found no other way to get it running. As there's no ebuild involved in this setup, you don't need to set any entries in