Skip to content
This repository has been archived by the owner on Dec 7, 2021. It is now read-only.

Commit

Permalink
Clarify --add-prefetch build flag (#510)
Browse files Browse the repository at this point in the history
* rename confusing --insert-dependency-links flag to --prefetch-dependencies

* rename prefetchDepedencies to addPrefetchLinks

* rename to insert-prefetch-links
  • Loading branch information
FredKSchott authored Dec 20, 2016
1 parent 840df15 commit 38023fa
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 15 deletions.
15 changes: 5 additions & 10 deletions src/build/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const buildDirectory = 'build/';

export interface BuildOptions {
swPrecacheConfig?: string;
insertDependencyLinks?: boolean;
insertPrefetchLinks?: boolean;
bundle?: boolean;
// TODO(fks) 07-21-2016: Fully complete these with available options
html?: {collapseWhitespace?: boolean; removeComments?: boolean};
Expand All @@ -56,11 +56,6 @@ export async function build(
js: Object.assign({minify: true}, options.js),
};

if (options.insertDependencyLinks) {
logger.debug(
`Additional dependency links will be inserted into application`);
}

logger.info(`Deleting build/ directory...`);
await del([buildDirectory]);

Expand Down Expand Up @@ -96,10 +91,10 @@ export async function build(

if (options.bundle) {
buildStream = buildStream.pipe(polymerProject.bundler);
} else {
buildStream = buildStream.pipe(gulpif(
options.insertDependencyLinks || false,
new PrefetchTransform(polymerProject)));
}

if (options.insertPrefetchLinks) {
buildStream = buildStream.pipe(new PrefetchTransform(polymerProject));
}

buildStream = buildStream
Expand Down
11 changes: 6 additions & 5 deletions src/commands/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,12 @@ export class BuildCommand implements Command {
'used for service worker generation.'
},
{
name: 'insert-dependency-links',
name: 'insert-prefetch-links',
type: Boolean,
description: 'Flatten dependency tree downloads by inserting ' +
'additional `<link rel="prefetch">` tags into ' +
'entrypoint and `<link rel="import">` tags into fragments and shell.'
description: 'Add dependency prefetching by inserting ' +
'`<link rel="prefetch">` tags into entrypoint and ' +
'`<link rel="import">` tags into fragments and shell for all ' +
'dependencies.'
},
{
name: 'html.collapseWhitespace',
Expand All @@ -64,7 +65,7 @@ export class BuildCommand implements Command {

let buildOptions: BuildOptions = {
swPrecacheConfig: options['sw-precache-config'],
insertDependencyLinks: options['insert-dependency-links'],
insertPrefetchLinks: options['insert-prefetch-links'],
bundle: options['bundle'],
html: {},
css: {},
Expand Down

0 comments on commit 38023fa

Please sign in to comment.