At the moment I am working on a top-secret Firefox Extension. The great Firefox Addon Builder was discontinued in January 2014 and I wanted to write shorter blog posts more often, so here is my Firefox add-on development environment (for beginners and Windows, although it should be easily applicable also on other operating systems).
SDK installation
- Install Python 2.5 or 2.6. Python versions 2.6.x, x > 6, are source-only released, so you need to compile them yourselves. Python 2.6.6 was the last version with a Windows installer.
- Download the Firefox SDK and unzip it somewhere.
- Execute addon-sdk-1.x\bin\activate.bat to test whether it works.
Creating your first project
- Create a new empty folder
- Start the SDK CLI from within that folder
- Execute cfx init in the CLI
- Execute cfx run to test the addon in a new, empty Firefox instance
All that could look like this:
C:\tmp>mkdir testaddon C:\tmp>cd testaddon C:\tmp\testaddon>C:\addon-sdk-1.15\bin\activate.bat Welcome to the Add-on SDK. For the docs, visit https://addons.mozilla.org/en-US/ developers/docs/sdk/latest/ (C:\addon-sdk-1.15) C:\tmp\testaddon>cfx init * lib directory created * data directory created * test directory created * doc directory created * README.md written * generated jID automatically: jid1-3nbhW4edkg5x6w * package.json written * test/test-main.js written * lib/main.js written * doc/main.md written Your sample add-on is now ready. Do "cfx test" to test it and "cfx run" to try it. Have fun! (C:\addon-sdk-1.15) C:\tmp\testaddon>cfx run Using binary at 'C:\Program Files (x86)\Mozilla Firefox\firefox.exe'. Using profile at 'c:\users\luebbers\appdata\local\temp\tmpv140_i.mozrunner'. JavaScript strict warning: resource://gre/modules/XPIProvider.jsm, line 6257: re ference to undefined property this.icons[32] Total time: 8.939000 seconds Program terminated successfully.
make.bat + Notepad++;
- To increase productivity I put the commands for packaging and executing the add-on in development in a “make.bat”.
cd C:\addon-sdk-1.15\bin\ call activate.bat cd C:\git\majascan\ cfx run
- Open the run dialog in Notepad++ with F5 and let it open this file. With “Save” you can create a shortcut for this command.
- Develop great Firefox extensions.
- ???
- non-profit!