diff options
| author | Miquel Sabaté Solà <msabate@suse.com> | 2016-05-31 12:29:41 +0200 |
|---|---|---|
| committer | Miquel Sabaté Solà <msabate@suse.com> | 2016-05-31 12:29:41 +0200 |
| commit | 2cd03d15f8c8d8c29daef2efb4406825de8b0b12 (patch) | |
| tree | ffe0585ff717f38099c9468eb6cc5a878e5489e3 /bin/sass | |
| parent | 30862ed08e26f4c1ee2c4cce8c419b8c9fbfe568 (diff) | |
| download | dotfiles-2cd03d15f8c8d8c29daef2efb4406825de8b0b12.tar.gz dotfiles-2cd03d15f8c8d8c29daef2efb4406825de8b0b12.zip | |
Added the `bin` directory and sorted out licensing
Everything is licensed under the MIT license, except what it's inside of the
`bin` directory, which is licensed under the GPLv3+ license.
Signed-off-by: Miquel Sabaté Solà <msabate@suse.com>
Diffstat (limited to 'bin/sass')
| -rw-r--r-- | bin/sass | 78 |
1 files changed, 78 insertions, 0 deletions
diff --git a/bin/sass b/bin/sass new file mode 100644 index 0000000..8e3fc10 --- /dev/null +++ b/bin/sass @@ -0,0 +1,78 @@ +#!/bin/sh +# Copyright (C) 2014-2016 Miquel Sabaté Solà <mikisabate@gmail.com> +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +# Launch a background job that deals with SASS/SCSS. +# +# If no arguments were given, then it will try to kill a previous instance +# of the background job and launch another one. You can prevent the +# re-launching by passing the "stop" argument. This way, this script will +# efectively kill the currently running process and quit. Any other argument +# will be ignored. +# +# Therefore, the usage of this script is as follows: +# +# $ sass [stop] +# + + +## +# Config values. +# +# NOTE: path values should *not* start and/or end with a slash. + +# The base directory. +dir="$( cd "$( dirname "$0" )" && pwd )/.." + +# The absolute path to the directory where we can store temporary files. You +# don't really want to use this default since it can easily clash with other +# projects ;) +tmp="/tmp" + +# The absolute path to the file that will store the PID of the currently +# running background job. +pidfile="$tmp/assets.pid" + +# The absolute path to the SASS log. +csslog="$tmp/sass.log" + +# The absolute path of the directory containing the SASS files. +cssdir="$dir/public/stylesheets" + + +## +# And here starts the script itself. + + +# Get pidfile. +mkdir -p $tmp +touch $pidfile + +# Kill off old processes +while read pid; do + kill $pid > /dev/null 2>&1; +done < $pidfile + +# Truncate the PID file +> $pidfile + +# If the user just wanted to stop all old processes, then exit here. +if [[ $1 == "stop" ]]; then + exit 1 +fi + +# SASS +sass --watch "$cssdir" > $csslog 2>&1 & +echo $! >> $pidfile |
