Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

A package manager for web assets

Do you know a package manager for web assets?

I'd like something that can download libraries such as jQuery so I can plug them into my asset pipeline. The js.* python packages for fanstatic are close, but they pick a single "latest" version of the library, which can lag a few releases behind.

Google's js cdn has the metadata for a few of them, but is mostly designed to be downloaded by the browser directly.

like image 723
Tobu Avatar asked Sep 08 '11 10:09

Tobu


1 Answers

I've found these package managers for in-browser javascript:

  • CPM (CommonJS package manager), focused on Dojo packages, with an archive at http://packages.dojofoundation.org/ (about 60 packages). CPM augments the CommonJS format with a mappings field to describe how modules from dependent packages can be require()d
  • Caolan's Jam, whose archive is at http://jamjs.org/packages/. Here is the Jam packaging guide.
  • Ender piggybacks on npm for package management, and provides a client that looks like AMD (I'm not sure about AMD compatibility, which according to a bug report is left up to each package). Here are the Ender packaging docs. Here are packages with the ender keyword. Ender doesn't focus on packaging existing libraries, though its Jeesh starter pack is a modular, mostly-compatible replacement for jQuery.

Most of these can publish in the AMD format for browser loaders, and can be loaded by RequireJS. They also tend to use the CommonJS package format (also used by npm) for their package.json metadata.

I also found XStatic, which seems to be a less-active version of fanstatic, and like fanstatic wraps the libraries in Python packages. It has the same limitation (versions tend to lag), but writing a wrapper package seems simple enough that I can bake my own updates.

BPM and fanstatic are aware of non-js assets and can merge or minify CSS.

like image 149
Tobu Avatar answered Oct 14 '22 15:10

Tobu