Firefox 扩展文件结构
我正在努力更新 Greasemonkey 编译器来打包 Firefox 扩展。我认为原始版本适用于 Firefox 版本 3.6 和 Greasemonkey 版本 0.7.20070607.0,源代码位于 GitHub 此处。我将在此处进行更新。
我试图弄清楚 Firefox 9/10 扩展的当前要求是什么,以便我可以确保生成适当的文件结构。
有谁知道以下文件结构是否是当前的:
MyExt/
chrome/
chrome/chromeFiles/
chrome/chromeFiles/content/
MyExt.js
defaults/
defaults/preferences/
prefs.js
chrome.manifest
install.rdf
原始编译器为不修改浏览器镶边的 Greasemonkey 脚本输出此文件:
MyExt/
chrome/
content/
MyExt.js
prefs.js
compiler.js
xmlhttprequester.js
chrome.manifest
install.rdf
下一步将是确保编译器使用的 Greasemonkey 代码是最新的,但是我想首先明确我的产出目标。
I'm working on updating a Greasemonkey compiler to package Firefox extensions. I think the original version was for Firefox version 3.6 and Greasemonkey version 0.7.20070607.0, and the source code is on GitHub here. I'm going to be working on my update here.
I'm trying to figure out what the current requirements are for Firefox 9/10 extensions so that I can make sure that I am generating the appropriate file structure.
Does anyone know if the following file structure is the current one:
MyExt/
chrome/
chrome/chromeFiles/
chrome/chromeFiles/content/
MyExt.js
defaults/
defaults/preferences/
prefs.js
chrome.manifest
install.rdf
The original compiler outputs this for a Greasemonkey script that does not modify the browser chrome:
MyExt/
chrome/
content/
MyExt.js
prefs.js
compiler.js
xmlhttprequester.js
chrome.manifest
install.rdf
The next step will be to make sure that the Greasemonkey code that the compiler uses is current, but I want to get my output goals clear first.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是一个典型/可接受的结构(尽管大多数人不会将
content
嵌套在chromeFiles
下;chrome/content
就足够了)。典型的结构可以在此处找到:但是,请注意以下事项:
文件 实际上可以放置在您想要的任何位置,只要您在
chrome.manifest
中正确注册这些位置即可。
组件也可以位于任何位置。与 chrome 文件一样,该位置必须在清单中注册。
另一方面,默认值必须位于
defaults
文件夹中:<块引用>
用于播种用户个人资料的默认文件应该是
放置在扩展文件夹根目录下的 defaults/ 中
等级制度。默认首选项 .js 文件应存储在
defaults/preferences/ - 当您将它们放在这里时,它们将是
Firefox 的首选项系统在启动时自动加载
您可以使用首选项 API 访问它们。
install.rdf
和chrome.manifest
都应驻留在扩展程序的顶级目录That's a typical/acceptable structure (although most people wouldn't nest
content
underchromeFiles
;chrome/content
is sufficient). A typical structure can be found here:However, note the following:
The files under
chrome
can actually be placed anywhere you want, as long as you register those locations properly in thechrome.manifest
Components can also be located anywhere. As with the chrome files, the location must be registered in the manifest.
Defaults, on the other hand, must be in the
defaults
folder:Both
install.rdf
andchrome.manifest
should reside in the top-level directory of the extension