Skip to content

Instantly share code, notes, and snippets.

@bmihelac
Created August 9, 2013 12:43
Show Gist options
  • Save bmihelac/6193333 to your computer and use it in GitHub Desktop.
Save bmihelac/6193333 to your computer and use it in GitHub Desktop.
Alias to watch and recompile less files on change, printing errors. Requires watchr.
alias watchless='watchr -e '\''require "date"; watch("(.*)\.less$") { |f| cmd = "lessc #{f[0]} --source-map #{f[1]}.css"; puts "#{DateTime.now}: #{cmd}"; output = `#{cmd}`; if $? != 0 then puts output end }'\'''
@bmihelac
Copy link
Author

bmihelac commented Aug 9, 2013

Sample output:

$ watchless
2013-08-09T14:43:34+02:00: lessc style.less --source-map style.css
2013-08-09T14:43:44+02:00: lessc style.less --source-map style.css
ParseError: Unrecognised input in /Users/foo/dev/html/less.js/style.less on line 5, column 3:
4   }
5   x
6 }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment