Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Grunt task used to package private Chrome Extensions.
JavaScript

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
bin
lib
tasks
test
.gitignore
.travis.yml
LICENSE-MIT
README.md
grunt.js
package.json

README.md

grunt-crx

Build Status

Package your Chrome Extensions in a bliss.

Getting Started

Install this grunt plugin next to your project's grunt.js gruntfile with: npm install grunt-crx

Then add this line to your project's grunt.js gruntfile:

grunt.loadNpmTasks('grunt-crx');

Documentation

This task is a multi task, meaning that grunt will automatically iterate over all crx targets if a target is not specified.

There will be as many extension packaged as there are targets.

Target Properties

  • src (string, mandatory): location of a folder containing a Chrome Extension manifest.json;
  • dest (string, mandatory): location of a folder where the crx file will be available;
  • baseURL (string): folder URL where package files will be self hosted (see Autoupdating in Chrome Extension docs);
  • exclude (array): array of glob style src-relative paths which won't be included in the built package;
  • privateKey (string): location of the .pem file used to encrypt your extension;
  • filename (string|template pattern): filename of the package (like myExtension.crx) – manifest attributes are injected from the manifest.json;
  • options (object) – options that are directly provided to the ChromeExtension object;

Target Defaults

  • privateKey: key.pem — which means the task will look forward its file next to the grunt.js one;
  • filename: <%= pkg.name %>-<%= manifest.version %>.crx – which means it will automagically use your package.json name and manifest.json version to build the filename.

Example

//grunt.js
grunt.loadNpmTasks('grunt-crx');

grunt.initConfig({
  crx: {
    myPublicPackage: {
      "src": "src/",
      "dest": "dist/crx/",
    },
    myHostedPackage: {
      "src": "src-beta/",
      "dest": "dist/crx-beta/src",
      "baseURL": "http://my.app.net/beta-files/",
      "exclude": [ ".git", ".svn" ],
      "privateKey": "dist/crx-beta/key.pem",
      "options": {
        "maxBuffer": 3000 * 1024 //build extension with a weight up to 3MB
      }
    }
  }
});

Security Notice

It is strongly recommended to store your privates keys outside the source folder of your extensions.

Otherwise we will laught at you.

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 [grunt][grunt].

Release History

0.1.2 (11/14/2012)

  • grunt 0.4 compatibility
  • credits to jed for its crx node module

0.1.1 (08/24/2012)

  • added exclude property

0.1.0 (08/23/2012)

Initial release.

Credits

  • Jed Schmidt for the useful crx module
  • Grunt authors for this great toolbox
  • you, contributor, user or anyone providing a feedback

License

Copyright (c) 2012 oncletom Licensed under the MIT license.

Something went wrong with that request. Please try again.