Philosophy

Duo was designed from the ground up to grow alongside your application, making your three main workflows incredibly simple:

creating quick proofs of concept

writing modular components

building large web applications

I. Proofs of Concept

As developers, we often need to test out an idea or isolate a bug. One of the big issues with existing package managers is that you cannot use your package manager without a lot of boilerplate files like package.json or component.json.

Duo will take care of the rest, transforming the .html into a Javascript string, and .json into a Javascript object.

When you’re ready to build your files, just run:

$ duo index.js index.css

The new files will be located in the newly created build/ directory, using the same structure as your project.

II. Components

A successful package manager needs to have a strong component ecosystem. Duo supports all of the existing Component packages out of the box. And, since Duo can load from paths, it supports many Bower packages too. There are even plans to support Browserify packages as well.

We’re hoping to bridge the gap between all the different package managers and come up with a solution that works for everyone.

To create your own public component, just add a component.json to your repository:

And then publish your component on GitHub, so that others can install it by simply requiring it into their application:

var thing =require('your/duo-component');

If you’re coming from the Component community, you’ll notice that we no longer need to add scripts, styles or templates. Duo handles all of this for you, walking the dependency tree like Browserify and including everything you need automatically, for both Javascript and CSS!

III. Web Applications

In order for a package manager to be truly useful, it needs to scale to accommodate building entire web applications. Once again, Duo makes this process seamless.

Duo allows for building multiple pages at once, so that you can split up your application into different bundles and keep your page assets slim. To build from multiple entry files, just pass more than one entry into duo:

$ duo app/home.js app/about.js app/admin.js

You can even use brace expansion:

$ duo app/{home,about,admin}/index.{js,css}

If Duo discovers an asset like an image or font along the way, it will automatically include it in your build/ directory. Say we have the following image in our CSS file: