Giter Club home page Giter Club logo

crxautoreload's Introduction

crxautoreload

chrome extension development runtime auto reload

NPM

Getting Started

This plugin you can call in anywhere not only gulp but also pure node.

you may install this plugin with this command:

npm install crxautoreload --save-dev

Setup

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

var crxAutoReload = require('crxautoreload');


gulp.task('autoreload', function() {
    crxAutoReload({
        extensionDir: "./src"
    });
})

manifest.json

{
    ...
    ,
    "background": {
        "scripts": ["reload.js"] // add 
    },
    ...

}

In the above example, whenever there are changes to the project's Javascript or HTML files the autoreload task kicks off creating a reload.html in the designated extensionDir with just a simple timestamp. Here would be the sample contents of reload.html.

1403936558108

On the first run of autoreload the reload.js will be created in the designated extensionDir. Its job is to check the reload.html file every second to see if the timestamp has changed. If the timestamp has changed a chrome.runtime.reload() will be executed on reload.html. This eliminates the need to go to chrome://extensions and perform a manual refresh.

Options

Property Necessary Type Plugin default value
extensionDir yes 'String' '/tmp'

Demo

see the cozhihu project or search keyword generated by crxautoreload in github.

Contributing

In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using Gulp.

Credits

Inspired by grunt-crx-auto-reload project.

License

Copyright (c) 2016 Terry Cai. Licensed under the MIT license.

crxautoreload's People

Contributors

icai avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

erikvold

crxautoreload's Issues

Finished 'autoreload' after 7.7 ms

I've used the example provided in the readme.
The gulp task executes and stops immediately.
Isn't this supposed to run in watch mode?

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.