Skip to content

Commit

Permalink
Support subfont --[no-]recursive
Browse files Browse the repository at this point in the history
  • Loading branch information
papandreou committed Nov 14, 2017
1 parent 39248b7 commit 2f06aff
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions bin/subfont
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,12 @@ var commandLineOptions = optimist
default: 'woff',
demand: false
})
.options('recursive', {
alias: 'r',
describe: 'Crawl all HTML-pages linked with relative and root relative links. This stays inside your domain',
type: 'boolean',
default: true
})
.options('d', {
alias: 'debug',
describe: 'Verbose insigts into font glyph detection',
Expand Down Expand Up @@ -131,14 +137,20 @@ if (rootUrl.indexOf('file:') === -1) {
assetGraphConfig.canonicalRoot = rootUrl.replace(/\/?$/, '/'); // Ensure trailing slash
}

var followRelationsQuery = {
crossorigin: false
};

if (!commandLineOptions.recursive) {
followRelationsQuery.type = AssetGraph.query.not(/Anchor$/);
}

var assetGraph = new AssetGraph(assetGraphConfig);
assetGraph
.logEvents()
.loadAssets(inputUrls)
.populate({
followRelations: {
crossorigin: false
}
followRelations: followRelationsQuery
})
.subsetGoogleFonts({
debug: debug,
Expand Down

0 comments on commit 2f06aff

Please sign in to comment.