Permalink
Browse files

Merge pull request #22 from k88hudson/notify

Use node-notifier instead of growl for notifications
  • Loading branch information...
2 parents 33280f4 + d6391ca commit 8995bc35cdbf22e2f444419233da3b539ecd3fee @jgonera committed May 27, 2015
Showing with 13 additions and 7 deletions.
  1. +3 −1 README.md
  2. +8 −4 bin/autoless
  3. +2 −2 package.json
View
@@ -5,7 +5,7 @@ Another .less file watcher, but this time with:
* Dependency tracking (if a file imported by other files changes, they get
compiled).
-* Growl notifications (a notification with summary shows up after each time
+* Cross-platform notifications via [node-notifier](https://www.npmjs.com/package/node-notifier) (a notification with summary shows up after each time
something is compiled).
@@ -22,6 +22,8 @@ Usage
-h, --help output usage information
--interval <ms> How often files are checked for changes
--no-watch Compile what needs to be compiled and exit
+ --no-notify Do not send any notifications
+ --no-sound Do not play a sound with error notifications
--source-map Generate source map files next to css files
--autoprefix <browsers> Browserslist query, e.g. '> 1%, last 2 versions'
--compile-imports Compile imported files, not just the files that import them
View
@@ -4,7 +4,7 @@
var path = require('path');
var util = require('util');
var watch = require('watch');
-var growl = require('growl');
+var notifier = require('node-notifier');
var program = require('commander');
var less = require('less');
var Manager = require('../lib/manager');
@@ -13,6 +13,8 @@ program
.usage('[options] <source_dir> [destination_dir]')
.option('--interval <ms>', 'How often files are checked for changes', 100)
.option('--no-watch', "Compile what needs to be compiled and exit")
+ .option('--no-notify', "Do not send any notifications")
+ .option('--no-sound', "Do not play a sound with error notifications")
.option('--source-map', "Generate source map files next to css files")
.option('--autoprefix <browsers>', "Browserslist query, e.g. '> 1%, last 2 versions'")
.option('--compile-imports', "Compile imported files, not just the files that import them")
@@ -76,9 +78,11 @@ function notify(summary) {
result === 'success' ? summary.length : message.length
));
- growl(message.join('\n'), {
+ notifier.notify({
title: 'LESS',
- image: path.join(__dirname, '../images', result + '.svg')
+ message: message.join('\n'),
+ icon: path.join(__dirname, '../images', result + '.svg'),
+ sound: program.sound && result === 'error'
});
}
@@ -117,7 +121,7 @@ watch.createMonitor(srcDir, monitorOptions, function(monitor) {
monitor.on('created', check);
monitor.on('removed', manager.remove.bind(manager));
- manager.on('checkSummary', notify);
+ if (program.notify) manager.on('checkSummary', notify);
console.log('Monitoring files in ' + srcDir);
});
View
@@ -10,10 +10,10 @@
"repository": { "type": "git", "url": "https://github.com/jgonera/autoless.git" },
"dependencies": {
"watch": "0.14.0",
- "growl": "1.7.0",
"commander": "2.1.0",
"less": "1.7.5",
- "autoprefixer-core": "5.1.7"
+ "autoprefixer-core": "5.1.7",
+ "node-notifier": "^4.2.1"
},
"devDependencies": {
"jshint": "*",

0 comments on commit 8995bc3

Please sign in to comment.