跳到主要内容

管理应用程序依赖性:顶级工具

+$Managing your application's dependencies can be painful, so it's no surprise that almost all languages have package management solutions.

+$Most people will have heard of NPM when it was associated with Node.js, but there are also options available to client-side JavaScript and other client-side technologies.

+$Here are four tools that should make your life easier.

+$01. Bower Bower

+$Bower.io+$is probably the most popular choice. This was used in the real-time analytics application, but the dependencies were checked in to simplify the getting started process. bower. json is the manifest file used to reference dependencies. One restriction is that Bower supports a flat dependency tree, so multiple versions of the same package aren't supported.

+$02. NPM NPM

+$npmjs.org+$is generally referenced in assocation with Node.js packages, but the contents of a package doesn't have to be a Node.js module. NPM is seeing increased usage for client-side JavaScript when applications are built with developer tools such asBrowserify

+$The manifest file is package. json and NPM (along with Browserify) provides support for deep-dependency tree. This means multiple versions of the same package are supported.

+$03. Component.io

+$Component.io+$takes a slightly different approach, based on thinking about packages asWeb组件+$that may contain JS, HTML, CSS and so on. JavaScript should be defined and included using a CommonJS syntax. The manifest used is component.json and dependencies can be managed using the+$component-set Command

+$04. JSPM

+$JSPM+$is an entirely browser-focused solution tied to the+$System.JS module loading system+$(github.com/systemjs/systemjs), which is a Universal Module Loader that means any module type can be loaded. It uses package.json and dependencies can be referenced and retrieved from JSPM or NPM.

话: Phil Leggetter

Phil Leggetter是实时网络技术,JavaScript,HTML5的专家。在Twitter上关注他@leggetter

像这样?读这个!



翻译字数超限