问题
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.
回答1:
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.
回答2:
Bower, the package manager, from Twitter.
Bower is a package manager for the web. Bower lets you easily install assets such as images, CSS and JavaScript, and manages dependencies for you.
Bower does package management and package management only.
Bower requires Node and npm (and possibly git for some bower packages). It is also included in Yeoman, a set of tools to help developers build modern web apps.
回答3:
If you are on Visual Studio 2010, NuGet is best
http://nuget.org/
回答4:
The author of RequireJS has also created a package / dependency manager called Volo:
Create browser-based, front-end projects from project templates, and add dependencies by fetching them from GitHub. Once your project is set up, automate common tasks.
volo is dependency manager and project creation tool that favors GitHub for the package repository.
At its heart, volo is a generic command runner -- you can create new commands for volo, and you can use commands others have created.
回答5:
Just use npm. It has tons of browser modules in it already, and is way larger than the other options:
http://www.modulecounts.com/
来源:https://stackoverflow.com/questions/7346716/a-package-manager-for-web-assets