@@ -118,6 +118,7 @@ var CSSLoaderPlugin;
118118 config = config || { } ;
119119 var myConfig = config [ 'vs/css' ] || { } ;
120120 global . inlineResources = myConfig . inlineResources ;
121+ global . inlineResourcesLimit = myConfig . inlineResourcesLimit || 5000 ;
121122 var cssUrl = req . toUrl ( name + '.css' ) ;
122123 this . cssLoader . load ( name , cssUrl , function ( contents ) {
123124 // Contents has the CSS file contents if we are in a build
@@ -156,7 +157,7 @@ var CSSLoaderPlugin;
156157 ] , entries = global . cssPluginEntryPoints [ moduleName ] ;
157158 for ( var i = 0 ; i < entries . length ; i ++ ) {
158159 if ( global . inlineResources ) {
159- contents . push ( Utilities . rewriteOrInlineUrls ( entries [ i ] . fsPath , entries [ i ] . moduleName , moduleName , entries [ i ] . contents , global . inlineResources === 'base64' ) ) ;
160+ contents . push ( Utilities . rewriteOrInlineUrls ( entries [ i ] . fsPath , entries [ i ] . moduleName , moduleName , entries [ i ] . contents , global . inlineResources === 'base64' , global . inlineResourcesLimit ) ) ;
160161 }
161162 else {
162163 contents . push ( Utilities . rewriteUrls ( entries [ i ] . moduleName , moduleName , entries [ i ] . contents ) ) ;
@@ -307,14 +308,14 @@ var CSSLoaderPlugin;
307308 return Utilities . relativePath ( newFile , absoluteUrl ) ;
308309 } ) ;
309310 } ;
310- Utilities . rewriteOrInlineUrls = function ( originalFileFSPath , originalFile , newFile , contents , forceBase64 ) {
311+ Utilities . rewriteOrInlineUrls = function ( originalFileFSPath , originalFile , newFile , contents , forceBase64 , inlineByteLimit ) {
311312 var fs = require . nodeRequire ( 'fs' ) ;
312313 var path = require . nodeRequire ( 'path' ) ;
313314 return this . _replaceURL ( contents , function ( url ) {
314315 if ( / \. ( s v g | p n g ) $ / . test ( url ) ) {
315316 var fsPath = path . join ( path . dirname ( originalFileFSPath ) , url ) ;
316317 var fileContents = fs . readFileSync ( fsPath ) ;
317- if ( fileContents . length < 5000 ) {
318+ if ( fileContents . length < inlineByteLimit ) {
318319 global . cssInlinedResources = global . cssInlinedResources || [ ] ;
319320 var normalizedFSPath = fsPath . replace ( / \\ / g, '/' ) ;
320321 if ( global . cssInlinedResources . indexOf ( normalizedFSPath ) >= 0 ) {
0 commit comments