Chrome Extension Building Tools
Tools to help compile a Chrome extension from a userscript
view on
github

js2crx.py

Converts a Javascript userscript (.user.js) into a chrome extension (.crx)

Required software

Downloads

Command line usage

js2crx.py is mainly designed as a command line application. It includes a template Windows batch script build.bat which can be easily edited to auto-build a project. Simply edit the EDIT_THIS parts in it.

Arguments are passed into js2crx.py using short (-v) or verbose (--version) flags. Executing js2crx.py --usage will list the available flags, their aliases, and a short description. Reading build.bat also helps.

Library import usage

js2crx.py should also be able to be imported as a library and executed in a similar manner to the command line version. This is untested/undocumented, but there's no real reason why it shouldn't work. If this functionality is required, reading through js2crx.py's main should give some insight.

Userscript metadata

Typical userscript files contain a metadata block at the top of the file. To specify additional info for building the .crx file, an additional ==ChromeExtension== metadata block should follow it. For example:

// ==ChromeExtension== // @permission storage // @icon-size 16:bilinear // @icon-size 32:bilinear // @icon-size 128:neighbor // @require additional_javascript.js // @resource resource_filename.html // @update-url https://example.com/userscript.update.xml // @download-url https://example.com/userscript.crx // ==/ChromeExtension==

The following tags are allowed: