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
    Create Namespaced Classes with MooTools

    MooTools has always gotten a bit of grief for not inherently using and standardizing namespaced-based JavaScript classes like the Dojo Toolkit does.  Many developers create their classes as globals which is generally frowned up.  I mostly disagree with that stance, but each to their own.  In any event...

  • By
    CSS Animations Between Media Queries

    CSS animations are right up there with sliced bread. CSS animations are efficient because they can be hardware accelerated, they require no JavaScript overhead, and they are composed of very little CSS code. Quite often we add CSS transforms to elements via CSS during...

Incredible Demos

  • By
    Morphing Elements Using MooTools and CSS

    Morphing an element between CSS classes is another great trick the MooTools JavaScript library enables you to do. Morphing isn't the most practical use of MooTools, but it's still a trick at your disposal. Step 1: The XHTML The block of content that will change is...

  • By
    Animated 3D Flipping Menu with CSS

    CSS animations aren't just for basic fades or sliding elements anymore -- CSS animations are capable of much more.  I've showed you how you can create an exploding logo (applied with JavaScript, but all animation is CSS), an animated Photo Stack, a sweet...

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!