check if the file is online.


Check if the file is online

This plugin requires Grunt ~0.4.0

If you haven't used Grunt before, be sure to check out the Getting Started guide, as it explains how to create a Gruntfile as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:

npm install grunt-check-online

One the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:


In your project's Gruntfile, add a section named check-online to the data object passed into grunt.initConfig().

  pkg: grunt.file.readJSON('package.json'),
  'check-online': {
    options: {
        // the response status code should be 404 
        statusCode: 404,
        server: '',
        exitOnFail: true
    your_target: {
        files: [{
            cwd: 'directory',
            src: '**/*',
            // path on the server 
            dest: '<%= %>/<%= pkg.version %>'

Type: Number Default value: 404

The response should return this status code.

Type: String Default value: http://localhost

The server.

Type: function Default value: null

Callback when check failed.

Jan 18th, 2015 0.3.0

fix fileObj using expand

October 28th, 2013 0.1.3

Treat network error like 404 status.


Update output for error code.

June 18th, 2013 0.1.1

Add option onFailure.

April 1st, 2013 0.1.0

First version.