grunt-crx is a Grunt task used to package Chrome Extensions (and soon, WebExtensions).
Chrome extensions can either be:
- public: zip files to be uploaded on the Chrome Web Store;
- private: crx files to be signed with a private key and eventually self-hosted.
Compatibility: this extension is compatible with
grunt-crx<1.0.4? Please head to the Upgrading section.
Install this grunt plugin next to your project's Gruntfile.js with the following command:
npm install --save-dev grunt-crx
Then add this line to your project's
This task is a multi task, meaning that grunt will automatically iterate over all
crx targets if a target is not specified.
dest(string, mandatory): the filepath of your
options(object) – options that are directly provided to the
baseURL(string): folder URL where package files will be self hosted (see Autoupdating in Chrome Extension docs);
maxBuffer(Number): amount of bytes available to package the extension (see child_process#exec);
privateKey(string): location of the
.pemfile used to sign your
This example demonstrates how you can tweak your builds upon your own source architecture.
This example demonstrates how to build separate channels of packages within a same repository location.
Pretty handy to use a Git workflow and pre-release code before deploying it in production.
It is strongly recommended to store your privates keys (
.pem files) outside
the source folder of your extensions.
grunt-crx will exclude by default because we do not want this story to happen to you.
A few things have changed since
- file selection now relies on the grunt Task Configuration and Targets;
filenameoptions are not used anymore: simply use
.crxfilename to automatically get an unsigned or signed archive;
- no file will be created temporarily on your filesystem – it is nicer for your disk and faster as well;
- file exclusion now works whereas it was broken between
v1.0.4and possibly harmful.
I present my apologies for the troubles you could have encountered if you have been using
grunt-crx@^1.0.0 until now.
In lieu of a formal styleguide, take care to maintain the existing coding style.
If you don't add unit tests, someone will take care of that before shipping the module to NPM. Take any contribution as an opportunity to learn.
- Jed Schmidt for the useful crx module
- Grunt authors for this great toolbox
- you, contributor, user or anyone providing a feedback
The MIT License (MIT) Copyright © 2016 Thomas Parisot, and contributors
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.