0.2.1 • Published 9 years ago
website-dependency-tree v0.2.1
CLI Usage
npm install -g website-dependency-tree
the command
website-dependency-tree http://brillout.github.io/demo-website/simple_demo/
will print
ok http://brillout.github.io/demo-website/simple_demo/
├─┬ /hello.css
│ └── /duck.gif
├── /jquery.min.js
└── /hello.js
A more complete demonstration is available here
About
retrieves dependencies defined in
- HTML
- CSS
- ES2015/JSPM
- AMD/Require.JS
The dependencies are retrieved statically, i.e. the code is parsed and not executed.
API Usage
var website_dependency_tree = require('website-dependency-tree');
website_dependency_tree
.retrieve('path/to/index.html')
.then(function(code){
// direct dependencies defined in index.html
console.log(code.dependees);
// all transitive dependencies of index.html,
// i.e. dependencies defined in index.html, and dependencies of the dependencies, etc.
console.log(code.dependees_all);
});
Potential Use Cases
- HTTP2 server push dependencies
- Client-Side prefetching
- Build process for deployment