Skip to content

Instantly share code, notes, and snippets.

@caius
Created April 14, 2011 16:44
Show Gist options
  • Save caius/919884 to your computer and use it in GitHub Desktop.
Save caius/919884 to your computer and use it in GitHub Desktop.
# Watches ./wp-content/themes/**/*.scss for changes and recompiles
# them into css files in the same place.
#
# Installation:
# [sudo] gem install watchr
#
# Usage:
# watchr ./path/to/this/script.rb
#
# ^C to exit.
#
watch('wp-content/themes/.*?\.scss') do |md|
input = md[0] # wp-content/themes/sometheme/main.scss
output = input.gsub('.scss', '.css')
command = "sass --scss --watch #{input}:#{output}"
%x{#{command}}
puts "SASSy regenerated #{input} to #{output}"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment