Skip to content

Commit a6ce9ab

Browse files
clydinBrocco
authored andcommitted
fix(@angular/cli): standardize inline/rebase stylesheet behavior
1 parent e6707bf commit a6ce9ab

File tree

1 file changed

+9
-4
lines changed
  • packages/@angular/cli/models/webpack-configs

1 file changed

+9
-4
lines changed

Diff for: packages/@angular/cli/models/webpack-configs/styles.ts

+9-4
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ export function getStylesConfig(wco: WebpackConfigOptions) {
4444
const extraPlugins: any[] = [];
4545
const cssSourceMap = buildOptions.sourcemaps;
4646

47+
// Maximum resource size to inline (KiB)
48+
const maximumInlineSize = 10;
4749
// Minify/optimize css in production.
4850
const minimizeCss = buildOptions.target === 'production';
4951
// Convert absolute resource URLs to account for base-href and deploy-url.
@@ -110,12 +112,15 @@ export function getStylesConfig(wco: WebpackConfigOptions) {
110112
},
111113
{
112114
// TODO: inline .cur if not supporting IE (use browserslist to check)
113-
filter: (asset: PostcssUrlAsset) => !asset.hash && !asset.absolutePath.endsWith('.cur'),
115+
filter: (asset: PostcssUrlAsset) => {
116+
return maximumInlineSize > 0 && !asset.hash && !asset.absolutePath.endsWith('.cur');
117+
},
114118
url: 'inline',
115119
// NOTE: maxSize is in KB
116-
maxSize: 10,
120+
maxSize: maximumInlineSize,
117121
fallback: 'rebase',
118-
}
122+
},
123+
{ url: 'rebase' },
119124
]),
120125
autoprefixer(),
121126
];
@@ -126,7 +131,7 @@ export function getStylesConfig(wco: WebpackConfigOptions) {
126131
'postcss-url': 'postcssUrl',
127132
'postcss-import': 'postcssImports',
128133
},
129-
variables: { minimizeCss, baseHref, deployUrl, projectRoot }
134+
variables: { minimizeCss, baseHref, deployUrl, projectRoot, maximumInlineSize }
130135
};
131136

132137
// determine hashing format

0 commit comments

Comments
 (0)