Skip to content

liebrand/grunt-crx

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

46 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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][types_of_tasks], 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;
  • maxBuffer (Number): amount of bytes available to package the extension (see child_process#exec)

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.

Release History

0.1.1 (08/24/2012)

  • added exclude property

0.1.0 (08/23/2012)

Initial release.

License

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

About

Package your Chrome Extensions in a bliss.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%