Check if you're on a development version or the live version of your site
JavaScript
Switch branches/tags
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
css
doc default z-index Jun 6, 2016
.gitattributes
.travis.yml
README.md
index.html
is-dev.js
package.json

README.md

is-dev

Check if you're on a development version or the live version of your site

Build Status npm version

A tiny script that displays a message if you're on the development version of a site, so you can visually distinguish it from the live version.

Installation

is-dev is on npm, so installing it is as easy as doing:

$ npm install --save is-dev

Usage

Include either is-dev.js via a script tag, or require('is-dev') in your script. After that you can call it like this (all options are optional):

demo and full documentation

isDev({
  dev: [
    '.dev',
    'localhost',
    'file:///'
  ], // parts of the url that can mean you're developing
  message: 'development',
  style: 'top-left',
  // top-left, top-right, bottom, top, none
  custom: 'display: block; background-color: red; font: Comic Sans MS'
  // custom css that extends the style
});

Support

IE9 and up (array.map).

License

Apache 2.0