Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow minify skipping by file glob. #584

Merged
merged 2 commits into from
May 24, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 16 additions & 17 deletions packages/cli/src/build/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,24 +83,7 @@ export async function build(
}));
}

if (bundled) {
// Polymer 1.x and Polymer 2.x deal with relative urls in dom-module
// templates differently. Polymer CLI will attempt to provide a sensible
// default value for the `rewriteUrlsInTemplates` option passed to
// `polymer-bundler` based on the version of Polymer found in the project's
// folders. We will default to Polymer 1.x behavior unless 2.x is found.
const polymerVersion = await getPolymerVersion();
const bundlerOptions = {
rewriteUrlsInTemplates: !polymerVersion.startsWith('2.')
};
if (typeof options.bundle === 'object') {
Object.assign(bundlerOptions, options.bundle);
}
buildStream = buildStream.pipe(polymerProject.bundler(bundlerOptions));
}

const htmlSplitter = new HtmlSplitter();

buildStream = pipeStreams([
buildStream,
htmlSplitter.split(),
Expand All @@ -119,6 +102,22 @@ export async function build(
htmlSplitter.rejoin()
]);

if (bundled) {
// Polymer 1.x and Polymer 2.x deal with relative urls in dom-module
// templates differently. Polymer CLI will attempt to provide a sensible
// default value for the `rewriteUrlsInTemplates` option passed to
// `polymer-bundler` based on the version of Polymer found in the project's
// folders. We will default to Polymer 1.x behavior unless 2.x is found.
const polymerVersion = await getPolymerVersion();
const bundlerOptions = {
rewriteUrlsInTemplates: !polymerVersion.startsWith('2.')
};
if (typeof options.bundle === 'object') {
Object.assign(bundlerOptions, options.bundle);
}
buildStream = buildStream.pipe(polymerProject.bundler(bundlerOptions));
}

if (options.insertPrefetchLinks) {
buildStream = buildStream.pipe(polymerProject.addPrefetchLinks());
}
Expand Down