Package Your Firefox Extension into an XPI

By  on  

Yesterday I detailed the file/folder structure of a Firefox extension. Once you have your extension ready for testing, you need to package everything together into an XPI file. Luckily there's a quick and easy way to do so.

chrome.manifest Review

content myExtension jar:chrome/myExtension.jar!/content/
overlay chrome://browser/content/browser.xul chrome://myExtension/content/myExtension.xul
skin myExtension classic/1.0 jar:chrome/myExtension.jar!/skin/

Remember that the XPI build is based upon the chrome.manifest file.

The Shell / Cygwin Directives

cd myExtension/chrome
zip -r myExtension.jar content/* skin/*

We enter the chrome directory and generate a myExtension.jar file which holds all of the extension assets.

cd ..
zip myExtension.xpi install.rdf chrome.manifest chrome/myExtension.jar

We navigate to the top level extension directory and generate a myExtension.xpi file which serves as the extension's install package. That's all!

Now you have no excuses not to create your Firefox extension! When you have one completed, post it in the comments below -- I can't wait to see what you come up with!

Recent Features

  • By
    Facebook Open Graph META Tags

    It's no secret that Facebook has become a major traffic driver for all types of websites.  Nowadays even large corporations steer consumers toward their Facebook pages instead of the corporate websites directly.  And of course there are Facebook "Like" and "Recommend" widgets on every website.  One...

  • By
    Vibration API

    Many of the new APIs provided to us by browser vendors are more targeted toward the mobile user than the desktop user.  One of those simple APIs the Vibration API.  The Vibration API allows developers to direct the device, using JavaScript, to vibrate in...

Incredible Demos

  • By
    Dynamic Waveform Visualizations with wavesurfer.js

    Waveform images are an awesome addition to boring audio widgets.  They can be functional as well as aesthetically pleasing, allowing users to navigate audio visually.  I recently found wavesurfer.js, an amazing waveform image utility that uses to Web Audio API to create super customizable...

  • By
    MooTools Gone Wild: Element Flashing

    If you're like me and lay awake in bed at night, you've flipped on the TV and seen the commercials: misguided, attention-starved college girls fueled by alcohol ruining their futures by flashing lame camera-men on Spring Break. Why do they do it? Attention...

Discussion

  1. @blaka: Ant is awesome but if I posted that without a few Ant tutorials I’d be assassinated!

  2. ryan

    can you explain your chrome.manifest example? i’m confused

  3. Most excellent, Walsh!

  4. Your a step forward yourself now! Good

  5. Rodrigo

    Nice tip! Thks

  6. Usefull tip!
    Thanks

Wrap your code in <pre class="{language}"></pre> tags, link to a GitHub gist, JSFiddle fiddle, or CodePen pen to embed!