Git Product home page Git Product logo

grunt-notify's Introduction

grunt-notify NPM version Build Status Built with Grunt

Automatic desktop notifications for Grunt errors and warnings using Growl for OS X or Windows, Mountain Lion and Mavericks Notification Center, and Notify-Send.

grunt-notify

Screenshots

OS Tool Screenshots
OS X OS X Notification Center OS X Notification Center
OS X Growl for Mac Growl for Mac
Windows 8 Windows 8 notifications Windows 8 Notifications
Windows Growl for Windows Growl for Windows
Windows Snarl Snarl
Linux Notify-Send Notify-Send

Getting Started

This plugin recommends Grunt 0.4.1 or newer.

Installing

npm install grunt-notify --save-dev

Once that's done, add this line to your project's Gruntfile.js:

grunt.loadNpmTasks('grunt-notify');

That's all you need for automatic notifications.

Notify_Hooks Options

If you want change the automatic messaging configure a task called notify_hooks.

grunt.initConfig({
  // This is optional!
  notify_hooks: {
    options: {
      enabled: true,
      max_jshint_notifications: 5, // maximum number of notifications from jshint output
      title: "Project Name" // defaults to the name in package.json, or will use project directory's name
    }
  }
});

// Load the task
grunt.loadNpmTasks('grunt-notify');

// This is required if you use any options.
grunt.task.run('notify_hooks');

Showing Specific Notifications

Sometimes you want to show messages like "Uglify complete" or "Project Deployed" - that's easy to do too.

Custom Message - Grunt
Custom Message - Grunt
Custom Message - Notification Center
Custom Message - Notification Center
Custom Message - Notify-Send
Custom Message - Notify-Send
grunt.initConfig({
  notify: {
    task_name: {
      options: {
        // Task-specific options go here.
      }
    },
    watch: {
      options: {
        title: 'Task Complete',  // optional
        message: 'SASS and Uglify finished running', //required
      }
    },
    server: {
      options: {
        message: 'Server is ready!'
      }
    }
  }
});

grunt.loadNpmTasks('grunt-notify');

// simplified example
grunt.registerTask('server', [
  'uglify',
  'sass',
  'server',
  'notify:server'
  ]);

Options

  • title optional Notification title
  • message required Notification message

Tests

Run grunt to lint and run the tests.

Notification Systems

Mac

OS X Notification System

Support Included.

If you are using OS X 10.8 Mountain Lion or newer a notification system is built in, but Apple does not provide a notification API that Node can access. Only code written in Objective C and signed in XCode can access it. This is not very friendly for Node users so we are using the tiny signed MIT-licensed native application Terminal Notifier from Eloy Durán. I've changed the default icon which is owned by Apple to the Grunt logo.

Growl for OS X

Requires growlnotify for OS X.

Install growlnotify from the Growl Downloads Page. This will install in /usr/local/bin/growlnotify.

Windows

Snarl

Included with Snarl.

If you have downloaded and installed Snarl from Snarl's web site you'll have the commandline tool heysnarl as well.

Growl for Windows

Requires growlnotify for Windows.

Install growlnotify from the growlnotify Page.

Windows 8.1 Notifications

Nothing to install.

Create a pull request!

Linux

Notify-Send

Nothing to install.

I created an Ubuntu virutal machine and it had notify-send in the path.

I don't use Linux frequently so I don't know if this utility is available for other distros.

notify-send man page.

Chrome

Not supported yet.

Chrome has a notification system but I'm not sure if it's possible to use from a command-line Node app. Somebody could probably create a Chrome Plugin helper for this.

Notifications aren't showing

Run grunt -v (for verbose mode) to show grunt-notify debug messages. It will tell you what notification system it thinks it can use. Create an issue and I'll look into it asap.

About the Author

Hello fellow developer! My name is Dylan Greene. When not overwhelmed with my two kids I enjoy contributing to the open source community. I'm a tech lead at Opower. I lead a team using Grunt and Angular to build software that successfully helps people like us use less power. Not too long ago I co-created Doodle or Die, a hilarious web game with millions of doodles that won us Node Knockout for the "most fun" category. I'm dylang on Twitter and other places.

Some of my other Node projects:

Name Description Github Stars Npm Installs
grunt-prompt Interactive prompt for your Grunt config using console checkboxes, text input with filtering, password fields. 188 2,828
rss RSS feed generator. A really simple API to add RSS feeds to any project. 199 16,822
shortid Amazingly short non-sequential url-friendly unique id generator. 163 4,039
xml Fast and simple xml generator. Supports attributes, CDATA, etc. Includes tests and examples. 41 21,485
grunt-attention Display attention-grabbing messages in the terminal New! 816
flowdock-refined Flowdock desktop app custom UI New! 31
anthology Module information and stats for any @npmjs user New! TBD
observatory Beautiful UI for showing tasks running on the command line. New! 17
changelog Command line tool (and Node module) that generates a changelog in color output, markdown, or json for modules in npmjs.org's registry as well as any public github.com repo. 53 80
grunt-cat Echo a file to the terminal. Works with text, figlets, ascii art, and full-color ansi. New! 59
logging Super sexy color console logging with cluster support. 21 171

This list was generated using anthology.

License

Copyright (c) 2014 Dylan Greene, contributors.

Released under the MIT license.

Screenshots are CC BY-SA (Attribution-ShareAlike).


Generated using grunt-readme with grunt-templates-dylang on Saturday, April 26, 2014. Bitdeli Badge Google Analytics

grunt-notify's People

Contributors

dylang avatar couchand avatar jcoffin avatar gilluminate avatar joeybaker avatar johnmccalla avatar vivekvasani avatar iirvine avatar cyrusdavid avatar

Watchers

 avatar James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.