Packaging format for jQuery plugins

Packaging format for jQuery plugins

<div dir="ltr">For a while, I've been trying to make it possible to build a system to automatically install jQuery plugins into an application. In particular, I've wanted to be able to let Merb (a Ruby web framework I maintain -- <a href="http://merbivore.com/"> http://merbivore.com/</a>) install jQuery plugins simply and easily.<div>
</div><div>There are a few problems I needed to see solved:</div><div><ul><li>A way for package authors to describe the locations of the javascript files, the CSS files, and any images</li><li>A way for package authors to declare required dependencies</li>
<li>A way to write CSS files that don't need to provide explicit image paths</li></ul><div>I want to propose a packaging format that plugin authors can use. To get the ball rolling, I'm proposing a JSON file called metadata.json:</div>
<div>
</div><div>{</div><div>  "name": "tabs.jquery",</div><div>  "author": "Yehuda Katz",</div><div>  "dependencies": [</div><div>    "core.ui.jquery",</div>
<div>    "mouse.ui.jquery"</div><div>  ],</div><div>  "javascript": [</div><div>    "lib/utility.tabs.jquery",</div><div>    "lib/tabs.jquery",</div><div>  ],</div><div>  "cssDir": "css",</div>
<div>  "imageDir": "images"</div><div>}</div><div>
</div><div>Additionally, I'd like to propose that CSS files containing image paths use the token %imageDir% to refer to the directory where the images will be placed. This will allow automated tools (or even users themselves) to quickly modify CSS files with the correct relative (or absolute) path.</div>
<div>
</div><div>Does this stuff make sense? People seemed to be, in general, in favor of a more consistent package format, so I thought I'd get the ball rolling here.</div>
--
Yehuda Katz
Developer | Engine Yard
(ph) 718.877.1325
</div></div>