Skip to content

Commit

Permalink
fix(@angular/cli): update postcss loader and URL versions.
Browse files Browse the repository at this point in the history
  • Loading branch information
hansl committed Nov 20, 2017
1 parent 4ebf518 commit 6831492
Show file tree
Hide file tree
Showing 4 changed files with 133 additions and 113 deletions.
225 changes: 122 additions & 103 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@
"opn": "~5.1.0",
"portfinder": "~1.0.12",
"postcss-custom-properties": "^6.1.0",
"postcss-loader": "^1.3.3",
"postcss-url": "^5.1.2",
"postcss-loader": "^2.0.8",
"postcss-url": "^7.1.2",
"raw-loader": "^0.5.1",
"resolve": "^1.1.7",
"rxjs": "^5.5.2",
Expand Down
13 changes: 7 additions & 6 deletions packages/@angular/cli/models/webpack-configs/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,23 +59,24 @@ export function getStylesConfig(wco: WebpackConfigOptions) {

return [
postcssUrl({
url: (URL: string) => {
url: (URL: { url: string }) => {
const { url } = URL;
// Only convert root relative URLs, which CSS-Loader won't process into require().
if (!URL.startsWith('/') || URL.startsWith('//')) {
return URL;
if (!url.startsWith('/') || url.startsWith('//')) {
return URL.url;
}

if (deployUrl.match(/:\/\//)) {
// If deployUrl contains a scheme, ignore baseHref use deployUrl as is.
return `${deployUrl.replace(/\/$/, '')}${URL}`;
return `${deployUrl.replace(/\/$/, '')}${url}`;
} else if (baseHref.match(/:\/\//)) {
// If baseHref contains a scheme, include it as is.
return baseHref.replace(/\/$/, '') +
`/${deployUrl}/${URL}`.replace(/\/\/+/g, '/');
`/${deployUrl}/${url}`.replace(/\/\/+/g, '/');
} else {
// Join together base-href, deploy-url and the original URL.
// Also dedupe multiple slashes into single ones.
return `/${baseHref}/${deployUrl}/${URL}`.replace(/\/\/+/g, '/');
return `/${baseHref}/${deployUrl}/${url}`.replace(/\/\/+/g, '/');
}
}
}),
Expand Down
4 changes: 2 additions & 2 deletions packages/@angular/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@
"opn": "~5.1.0",
"portfinder": "~1.0.12",
"postcss-custom-properties": "^6.1.0",
"postcss-loader": "^1.3.3",
"postcss-url": "^5.1.2",
"postcss-loader": "^2.0.8",
"postcss-url": "^7.1.2",
"raw-loader": "^0.5.1",
"resolve": "^1.1.7",
"rxjs": "^5.5.2",
Expand Down

0 comments on commit 6831492

Please sign in to comment.