For information about other front-end package management options, check out this repository.
This example briefly demonstrates how we can benefit from using the Component package manager. Install it with the following command.
npm install -g componentThat will install the component program itself. To install packages in component.json, merely use:
component installBelow are the steps I took to create this example. You don't need to run these.
echo "{}" > component.json, to get a basiccomponent.jsoncomponent install lodash, which installed LoDash2.4.1
Afterwards, component build will builds the components we depend on, and puts them in a bundled build/build.js file, under CJS format.
As you can see, we didn't change the default installation directory in this case, and at the time of this writing, it isn't possible to do so, as it's hardcoded into component-installer to be './components'. If you find a way to work around this, other than doing component install -o js/components, which seems to be deprecated, please create an issue and I'll make sure to add it to this document.
Once you've built the components using component build, open the example from your shell, like below.
open test.html(or just open test.html in your favorite browser)
The next example shows how to automate the build step using Grunt.
