DynoSrc

DynoSRC is a general solution for efficiently delivering JS resources to clients, using diff-based updates as assets change over time.

Benefits

Minimize HTTP Requests

DynoSRC loads JavaScript files inline in your HTML response, then stores them in localStorage. You can even inline the calls to the DynoSRC client lib in your HTML response, eliminating all HTTP requests for JavaScript on your site.

Differential Updates

Normally, if a JS asset on your site changes, your users will have to download the entire file again even though just a fraction of it changed. DynoSRC sends down differentials updates so changes to large files don't require full downloads.

Getting Started

Install DynoSrc

npm install dynosrc

Configure Middleware

dynSrc.globals({
  //folder containing your JS / CSS files
  assetsDir: __dirname + '/assets'
});

//install express style middleware
app.use(dynoSrc.middleware());

dynSrc.assets({
  //point directly to files on github
  'ryanstevens/ModelFlow': {
    filename: 'package.json',
    source: 'git',
    //this can also be a tag
    head: '8050f1'
  },
  'jquery': {
    head: '1.9.1',
    //this lives on disk
    source: 'asset'
  }
});

Get Patches, Send to Client

app.get('/', function (req, res) {
  dynSrc.getPatches(req, {
    patches: ['jquery', 'backbone']
  }, function(err, patches) {
    res.render('index.html', {
      title: 'Super Cool Project',
      patches: patches
    });
  });
});
This will produce corresponding "patch" deltas in your HTML
//inserted from dynSrc.getPatches
dynoSrc.apply('my-cool-module', '0.1.2', '...diff...');

How does it work?

TODOs