@@ -47,6 +47,8 @@ export function getStylesConfig(wco: WebpackConfigOptions) {
4747 // https://github.com/webpack-contrib/style-loader#recommended-configuration
4848 const cssSourceMap = buildOptions . extractCss && buildOptions . sourcemaps ;
4949
50+ // Maximum resource size to inline (KiB)
51+ const maximumInlineSize = 10 ;
5052 // Minify/optimize css in production.
5153 const minimizeCss = buildOptions . target === 'production' ;
5254 // Convert absolute resource URLs to account for base-href and deploy-url.
@@ -122,12 +124,15 @@ export function getStylesConfig(wco: WebpackConfigOptions) {
122124 } ,
123125 {
124126 // TODO: inline .cur if not supporting IE (use browserslist to check)
125- filter : ( asset : PostcssUrlAsset ) => ! asset . hash && ! asset . absolutePath . endsWith ( '.cur' ) ,
127+ filter : ( asset : PostcssUrlAsset ) => {
128+ return maximumInlineSize > 0 && ! asset . hash && ! asset . absolutePath . endsWith ( '.cur' ) ;
129+ } ,
126130 url : 'inline' ,
127131 // NOTE: maxSize is in KB
128- maxSize : 10 ,
132+ maxSize : maximumInlineSize ,
129133 fallback : 'rebase' ,
130- }
134+ } ,
135+ { url : 'rebase' } ,
131136 ] ) ,
132137 autoprefixer ( ) ,
133138 ] . concat (
@@ -141,7 +146,7 @@ export function getStylesConfig(wco: WebpackConfigOptions) {
141146 'cssnano' : 'cssnano' ,
142147 'postcss-import' : 'postcssImports' ,
143148 } ,
144- variables : { minimizeCss, baseHref, deployUrl, projectRoot }
149+ variables : { minimizeCss, baseHref, deployUrl, projectRoot, maximumInlineSize }
145150 } ;
146151
147152 // determine hashing format
0 commit comments