|
Chrome Extension Building Tools
Tools to help compile a Chrome extension from a userscript
|
view on
github
|
Converts a Javascript userscript (.user.js) into a chrome extension (.crx)
.crx compilation
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.
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.
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:
The following tags are allowed:
.user.js script) to an additional Javascript file.==UserScript== block contains any @require tags.
.user.js script) to an additional resource file.==UserScript== block contains any @resource tags.
update.xml file generated by js2crx.py.
extension.crx file generated by js2crx.py.