开发一个Firefox扩展到位(不是通过编码到XPI第一)? [英] develop a firefox extension in place (not via encoding to xpi first)?

查看:206
本文介绍了开发一个Firefox扩展到位(不是通过编码到XPI第一)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为Mozilla Firefox开发扩展我想知道现在我所做的是否有一个更简单的方法。目前我做:
$ b


  1. 创建一个文件夹 - 在其中开发 - 例如 myextension 这里没有问题))

  2. code>到一个ZIP文件(即命名为myextension.zip) >
  3. 然后在firefox中安装xpi-file-firefox-extension

  4. 重新启动Firefox

    >
  5. 测试扩展程序


每次编辑扩展的代码库我需要经历3.压缩,4.重命名,5.安装XPI文件到Firefox,6重新启动浏览器。



当然,我可以自动化一些这个,但我仍然不知道是否有另一种方式来开发Firefox的扩展d直接在运行的firefox个人资料文件夹中。



我知道的扩展名存储在Firefox个人资料文件夹中:
firefox / profile / extensions / nameofextension.xpi



我不记得,但我认为有一种方法可以将扩展名解压缩为一个文件夹那里呢?这样,我仍然需要重新编辑后重新启动,但不做所有的laboursome zipping-renaming-installation。



有什么想法?

可以设置一个目录来就地编辑一个Firefox扩展。通过这种方式,可以减少Firefox扩展的编辑和测试工作。



我已经在博客上找到了很好的解释 https://blog.mozilla.org/addons/2009/01/28 / how-to-develop-a-firefox-extension /

这里我想介绍一下实现就地编辑



第一步:您必须找到Firefox的个人资料目录
例如在Linux中,这往往是这样的:
〜/ .mozilla / firefox /#%#%。default / 个人资料目录


第三步:如果您已经拥有(例如adblock +或noscript),然后在个人资料目录中找到名为 extensions 的文件夹。如果你还没有安装任何额外的扩展,可能很容易安装任何,只是为你设置**扩展名文件夹。

步骤4:在这个 extensions 文件夹中,你可以创建一个新的目录(让我们命名为myextensions_1),它应该包含你的插件的东西,这个东西就是普通的东西,比如 install.rdf chrome.manifest 文件和内容 skin locale 子目录实际上所有的东西,你将正常压缩成为XPI文件。 b
$ b

第5步。创建一个与您在安装中使用的< em:id> 标签内容相同的文件.rdf文件。因此,如果您使用< em:id> myextensionname@author.org< / em:id> ,您需要创建一个名为 myextensionname@author.org 。在这个文件里,你将写出我们创建的in-place-edit-extension-folder的位置d之前。在我们的例子中,我们将有


  • 文件 myextensionname@author.org

  • 仅包含文本〜/ .mozilla / firefox /#%#%。default / extensions / myextensions_1



当然,文本取决于您用于插件的文件夹的位置。

如果您正确地做了所有事情,并且可能使用上述链接的说明再次检查,则可以重新启动或重新启动firefox。浏览器会询问您是否允许使用插件 myextensionname@author.org ,您可以承认。



现在你可以在〜/ .mozilla / firefox /#%#%。default / extensions / myextensions_1 文件夹下编辑,不用担心压缩 - >重命名 - >安装。
您可以简单地重新启动Firefox,并且编辑到您的扩展代码将变得可用。



这可以让你更快速地开发in-place。


Developing an extension for Mozilla Firefox I wonder if there is an "easier way" to what I do right now. Currently I do:

  1. Create a folder - in which to develop - for example myextension

  2. Inside this folder: Create and Edit the Files (like install.rdf, chrome.manifest, xul files. Basically all the other structure of a Firefox extension (no problem here))

  3. Zip-compress the content of the myextension to a ZIP-file (i.e. named myextension.zip)

  4. Rename myextension.zip to myextension.xpi

  5. Install the xpi-file-firefox-extension then in firefox

  6. Restart Firefox

  7. Test the extention

After each edit to the codebase of the extension I need to undergo the process of 3. zip-compress, 4. Rename, 5. install XPI file to firefox, 6 restart browser.

Of course I could automate some of this but still I wonder if there is another way to develop the firefox extension directly in the running firefox profile folder .

The extensions I know are stored in the Firefox profile folder as: firefox/profile/extensions/nameofextension.xpi

I cannot remember well, but I think that there was a way to have the extension being stored unzipped as a folder there too? This way I would still need to restart after edits but not do all the laboursome zipping-renaming-installing.

Any ideas?

解决方案

It is possible to setup a directory to "in-place-edit" a firefox extension. By this the effort between editing and testing of the Firefox-extension can be reduced.

I have found the good explanation on the blog https://blog.mozilla.org/addons/2009/01/28/how-to-develop-a-firefox-extension/

Here I want to give the principal steps necessary to achieve the "in-place-edit"

Step 1: You have to find your profile directory of Firefox. For example in Linux this would often be often something like this: ~/.mozilla/firefox/#%#%.default/

Step 2: Go to this profile directory

Step 3: If you already have any extensions installed (like for example adblock+ or noscript), then inside this profile directory you will find a folder named extensions. If you do not have yet any additional extension installed, it might be easy to simply install any, only to have the **extensions" folder be setup for you.

Step 4: In this extensions folder you can create a new directory (let us name it "myextensions_1"), which shall contain the stuff of your plugin. This stuff would be the ordinary things like the install.rdf, chrome.manifest files and the content,skin,locale subdirectories. In effect all the stuff you would normaly zip up to become the XPI file.

Step 5. Create a file that is equal to the content of the <em:id> tag that you used in your ìnstall.rdf file. So if you used <em:id>myextensionname@author.org</em:id> you need to create a file named myextensionname@author.org. Inside this file you will write the location of the "in-place-edit-extension-folder" we created before. In our example this we would have

  • the file myextensionname@author.org
  • which contains only the text ~/.mozilla/firefox/#%#%.default/extensions/myextensions_1

Of course the text depends on the location of the folder you use for your plugin.

If you did all things correctly - and maybe double-checked with the instructions of the link above - you can restart or "newly start" firefox. The browser will ask you if you want to allow the usage of the plugin myextensionname@author.org, which you can conceed.

Now you can edit in the folder ~/.mozilla/firefox/#%#%.default/extensions/myextensions_1 and need not to worry about zipping-up -> renaming -> installing. You simple restart Firefox and the edits to your extensions code will become available.

This will allow you swifter and faster developing "in-place".

这篇关于开发一个Firefox扩展到位(不是通过编码到XPI第一)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆