Code Monkey home page Code Monkey logo

grunt-notify's Introduction

grunt-notify Build Status

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

Growl for Mac and Windows

growl-jshint growl-nodeunit

OS X Notifcation Center

notification-center-jshint

Snarl for Windows

snarl-nodeunit

Notify-Send for Linux

notify-send - jshint

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:

// Automatic notifications when tasks fail.
grunt.loadNpmTasks('grunt-notify');

That's all you need for automatic notifications.

notification-center-sidebar-jshint growl-jshint-lots

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 uses project's directory name, you can change to the name of your project
    }
  }
});

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

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

Showing Specfic Notifications

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

growl-deploy notification-center-deploy notify-send custom

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.

Notifications aren't showing

Run grunt --debug to show grunt-notify debug messages. Create an issue and I'll look into it asap.

Terminal Notifier

Apple does not provide an API to the OS X Notification Center that Node can access. Only code written in Objective C and signed in XCode can use 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.

Doodle or Die

This project was created for and is used by the free game I co-created for Node Knockout called Doodle or Die. Please give it a try, we think you will enjoy it!

Release History

See CHANGELOG.md for changes.

License

LICENSE-MIT

grunt-notify's People

Contributors

dylang avatar robhawkes avatar jcoffin avatar joeybaker avatar johnmccalla 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.