GithubHelp home page GithubHelp logo

grunt-chromeload's Introduction

grunt-chromeload

Grunt task for loading or reloading tabs in Chrome.

Tired of having a new tab open every time you use grunt-open after launching a server or something? Me too. grunt-chrome-load scans open tabs across Chrome and reloads the ones you want instead of opening a brand new one every time.

Prerequisites

How to use it

grunt.config({
  chromeload: {
      dev: {
          reload_pattern: 'https?:\/\/localhost:8080',
          new_url: 'http://localhost:8080'
        },
      prod: {
          reload_pattern: 'https?:\/\/jayeb.com',
          new_url: 'http://jayeb.com'
        }
    },
});

For each target, you can define an optional reload_pattern. This string will be turned into a regular expression and used to determine which (if any) open Chrome tabs should be reloaded when the task is run.

For each target, you must also define a new_url. If the task is run and no Chrome tabs are found that match the reload_pattern parameter (or no reload_pattern is defined for this task), a new tab will be opened at this URL.

Et cetera

If your server's hostname and port are already defined somewhere in your config, pipe these variables into grunt-chromeload to DRY out your shit:

grunt.config({
  chromeload: {
      dev: {
          reload_pattern: 'https?:\/\/<%= express.dev.options.hostname %>:<%= express.dev.options.port %>',
          new_url: 'http://<%= express.dev.options.hostname %>:<%= express.dev.options.port %>'
        }
    },
});

grunt-chromeload is also great when doing local development on Chrome extensions. where reloading the chrome://extensions page will reload your extension package:

grunt.config({
  chromeload: {
      extensions: {
          reload_pattern: 'chrome:\/\/extensions',
          new_url: 'chrome://extensions'
        }
    },
});

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.