Dependency management is a tool, which provides an organized way for managing software components to work together as a one system.
The following are a few StealJS key features:
Loading individual files only once
Loading files from different domains
Loading JavaScript and CoffeeScript
Loading CSS less
We have used StealJS many times in the previous chapters. Let's have a closer look at it now.
Using StealJS, we can load files as follows:
steal( 'file_one', 'file_two', function ($) { } );
These files are loaded in parallel and in a random order. If file_two
has dependences in file_one
, we can wait for file_one
before starting to fetch file_two
, as follows:
steal( 'file_one').then( 'file_two', function ($) { } );