DUO – Lifetime Technology and Gadget Master
  • Home
  • Digital Goods Refund Policy
  • Disclaimer
  • DMCA
  • External Links Policy
  • FTC Statement
  • Linking Policy
  • Sitemap
@2020 - All Right Reserved.
Blog

next-generation package manager

Read more
Blog

RCA Sport Neckband Review

Read more
Blog

Are In-Ear Monitors Safe For Singers?

Read more
Blog

What is Managed WordPress Hosting?

Read more
Blog

What is WordPress Cloud Hosting?

Read more
Blog

6 Things to Know Before Buying Your Next Electric Lighter

Read more
    DD
    Blog

    next-generation package manager

    by DuosDual December 22, 2017
    written by DuosDual

    Duo is a next-generation package manager that blends the best ideas from Component, Browserify and Go to make organizing and writing front-end code quick and painless.

    Install It

    Install Duo straight from npm with:

    $ npm install -g duo
    

    Getting Started

    To get started just write normal Javascript, requiring from GitHub as you need them:

    var uid = require('matthewmueller/uid');
    var fmt = require('yields/fmt');
    
    var msg = fmt('Your unique ID is %s!', uid());
    window.alert(msg);
    

    That matthewmueller/uid will pull the dependency straight from GitHub, without you needing to edit any package manifest file!

    You can also require modules straight from your file system:

    var modal = require('./modal/index.js');
    

    Then use duo to install your dependencies and build your file:

    $ duo index.js
    

    Finally, drop a single <script> onto your page and you’re done!

    <script src="build/index.js"></script>
    

    Same goes for CSS! You can require dependencies and assets straight from GitHub or from the file system:

    @import 'necolas/normalize.css';
    @import './layout/layout.css';
    
    body {
      color: teal;
      background: url('./background-image.jpg');
    }
    

    Then bundle up your CSS with duo:

    $ duo index.css
    

    And add your bundled-up stylesheet to your page!

    <link rel="stylesheet" href="build/index.css">
    

    Features

    1. has first-class support for Javascript, HTML and CSS
    2. exposes a unix-y command line interface
    3. pulls source directly from GitHub with semantic versioning
    4. supports source transforms, like Coffeescript or Sass
    5. does not require a manifest

    Philosophy

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

    1. creating quick proofs of concept
    2. writing modular components
    3. 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 removes this boilerplate, letting you require packages straight from your source code:

    var events = require('component/events');
    var uid = require('matthewmueller/uid');
    

    You can also include versions, branches or paths:

    var reactive = require('component/reactive@0.14.x');
    var tip = require('component/tip@master');
    var shortcuts = require('yields/shortcuts@0.0.1:/index.js');
    

    And the same goes for CSS with import:

    @import 'necolas/normalize.css';
    @import 'twbs/bootstrap@v3.2.0:dist/css/bootstrap.css';
    

    You can even directly require .html or .json files:

    var template = require('./menu.html');
    var schema = require('./schema.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:

    {
      "name": "duo-component",
      "version": "0.0.1",
      "main": "index.js",
      "dependencies": {
        "component/tip": "1.x",
        "jkroso/computed-style": "0.1.0"
      }
    }
    

    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:

    @import 'necolas/normalize.css';
    
    body {
      background: url('./images/duo.png');
    }
    

    Duo will symlink duo.png to build/images/duo.png, so that you can serve the entire build/ directory from your web server.

    Examples

    To see some more complex examples of Duo in the wild, check out any of these repositories on GitHub:

    • duojs/duojs.org
    • duojs/logo
    • segmentio/analytics.js

    Community

    For more information, read through some of the resources put together by the folks in the Duo community:

    • GitHub Repository
    • Command Line Usage
    • Javascript API
    • FAQ
    • Mailing List
    • #duojs on Freenode
    December 22, 2017 0 comment
    0 FacebookTwitterPinterestEmail
  • Blog

    RCA Sport Neckband Review

    by DuosDual February 9, 2020
    by DuosDual February 9, 2020

    Although I am quite happy with the pair of headphones that I am using, a couple of Panasonic Stereo Headphones, a friend of…

    Read more
  • Blog

    Are In-Ear Monitors Safe For Singers?

    by DuosDual March 31, 2019
    by DuosDual March 31, 2019

    There is no doubt that singers have a lot of tools available to them. This can be both a good and bad thing.…

    Read more
  • Blog

    What is Managed WordPress Hosting?

    by DuosDual March 29, 2019
    by DuosDual March 29, 2019

    Do you have the website you need? Most businesses have an online presence, but not many are happy with the hosting plan they…

    Read more
  • Blog

    What is WordPress Cloud Hosting?

    by DuosDual March 29, 2019
    by DuosDual March 29, 2019

    WordPress Cloud Hosting is a relatively newer and increasingly popular type of WordPress hosting. It is basically an alternative to Managed WordPress hosting…

    Read more
  • Blog

    6 Things to Know Before Buying Your Next Electric Lighter

    by DuosDual November 12, 2018
    by DuosDual November 12, 2018

    The world is continuously and steadily advancing towards futuristic, eco-friendly, and sustainable alternatives to traditional products. It is high time we shift our…

    Read more
  • Blog

    EditGrid Tutorial on Managing Spreadsheets from Your Workspace

    by DuosDual December 22, 2017
    by DuosDual December 22, 2017

    In this tutorial, I am going to show you how to manage your spreadsheets from your workspace in EditGrid. From your workspace, you…

    Read more
  • Blog

    Exploring Adobe Photoshop CS3: Droplets, Automating Your Tasks

    by DuosDual December 22, 2017
    by DuosDual December 22, 2017

    In Part 1, we created a Watermark Action for one or two images. Now what if you have to watermark tons of images?…

    Read more
  • Blog

    Microsoft Excel Tutorial: How to Use the Control Toolbox

    by DuosDual December 22, 2017
    by DuosDual December 22, 2017

    The Microsoft Office Excel Control Toolbox has many controls and this tutorial describes what each control does and how you can use them.…

    Read more
  • Blog

    A Review on Dell Inspiron i7559-763blk 15.6″ Full-HD Gaming Laptop

    by DuosDual December 22, 2017
    by DuosDual December 22, 2017

    You could well argue that Dell laptops are bulky, and not your choice if you are looking for portability and business use. However,…

    Read more
  • Blog

    Is a 14 Inch Gaming Laptop Screen Size Best for Gaming?

    by DuosDual December 22, 2017
    by DuosDual December 22, 2017

    Wondering whether it is worth investing in a 14 Inch gaming laptop screen size for your gaming needs? It may all depend on…

    Read more
  • 1
  • 2

About Me

About Me

John Travolta

Hi there, my name is Victor. Welcome to my adventure Blog. Join me on the adventure to the greatest things you can imagine around the world.

Keep in touch

Facebook Twitter Instagram Pinterest Youtube Email Snapchat

Subscribe Newsletter

Subscribe my Newsletter for new blog posts, tips & new photos. Let's stay updated!

Popular Posts

  • 1

    next-generation package manager

    December 22, 2017
  • 2

    Is a 14 Inch Gaming Laptop Screen Size Best for Gaming?

    December 22, 2017
  • 3

    Microsoft Excel Tutorial: How to Use the Control Toolbox

    December 22, 2017
  • 4

    Are In-Ear Monitors Safe For Singers?

    March 31, 2019
  • 5

    Why Do More People Choose to Buy an Asus Gaming Laptop?

    December 22, 2017
  • 6

    6 Things to Know Before Buying Your Next Electric Lighter

    November 12, 2018

Facebook Feed

Facebook

Categories

  • Blog (14)

Subscribe Newsletter

Subscribe my Newsletter for new blog posts, tips & new photos. Let's stay updated!

  • Facebook
  • Twitter
  • Instagram
  • Pinterest
  • Youtube
  • Email

@2020 - All Right Reserved.