How Mantri works

Mantri uses Namespaces. Each file provides a namespace and can require any number of other namespaces.

goog.provide('foo.bar'); // I provide this namespace. goog.require('foo.baz'); // I require this namespace. // The result is a giant dependency tree.

When developing, all your files are loaded synchronously before DOMContentLoaded event fires, just like your code would evaluate when packaged and minified. Using modern day build flows, Mantri will build your application removing all the provide and require statements.

Here is a breakdown of what happens when you do a page load during development, just hover over the diagram.

Mantri page loading sequence

Mantri wraps around the powerfull Google Closure Tools, the same tools used by most of Google's web assets. These tools were build for the purpose of easily managing and maintaining large codebases. Mantri lowers the barier of entry by abstracting all the complexity of such sophisticated systems. In other words, Mantri will be there for you from the second file up to thousands.