Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added a verbosity switch that includes inline assets in graph result

  • Loading branch information...
commit 59e7dfb1265be75fe89c7a5b770726ffb517404b 1 parent 4069d5b
@Munter authored
Showing with 16 additions and 6 deletions.
  1. +9 −1 bin/assetviz
  2. +7 −5 index.js
View
10 bin/assetviz
@@ -15,6 +15,12 @@ var optimist = require('optimist'),
type: 'string',
demand: false
})
+ .options('v', {
+ alias: 'verbose',
+ describe: 'Includes inline assets in the output graph. If not set only inline elements relevant to describe relations will be shown.',
+ type: 'boolean',
+ default: false
+ })
.wrap(72)
.argv;
@@ -81,7 +87,9 @@ new AssetGraph({root: rootUrl})
});
})
.populate({followRelations: followRelationsQueryObj, startAssets: {type: 'Html', isFragment: true, isInitial: true}})
- .assetviz()
+ .assetviz({
+ verbose: commandLineOptions.verbose
+ })
.writeStatsToStderr()
.run(function (err) {
if (err) {
View
12 index.js
@@ -31,9 +31,11 @@ var Path = require('path'),
CssAlphaImageLoader: 'AlphaImageLoader'
};
-module.exports = function (name) {
- name = (name || 'assetviz');
- var targetFileName = name + '.html',
+module.exports = function (config) {
+ config = config || {};
+ var name = (name || 'assetviz'),
+ targetFileName = name + '.html',
+ verbose = config.verbose,
data = {
assets: [],
relations: []
@@ -45,7 +47,7 @@ module.exports = function (name) {
query = assetGraph.constructor.query;
assetGraph.findAssets().forEach(function (asset) {
- if (asset.url || asset.outgoingRelations.length) {
+ if (verbose || asset.url || asset.outgoingRelations.length) {
asset.idx = idx;
var size = 400;
if (asset.url && asset.isLoaded) {
@@ -65,7 +67,7 @@ module.exports = function (name) {
});
assetGraph.findRelations().forEach(function (relation) {
- if ('idx' in relation.from && 'idx' in relation.to) {
+ if (verbose || ('idx' in relation.from && 'idx' in relation.to)) {
var typeString = relationLabelByType[relation.type] || '';
if (typeof typeString === 'function') {
typeString = typeString(relation);
Please sign in to comment.
Something went wrong with that request. Please try again.