File tree Expand file tree Collapse file tree 5 files changed +17
-11
lines changed Expand file tree Collapse file tree 5 files changed +17
-11
lines changed Original file line number Diff line number Diff line change @@ -331,11 +331,11 @@ const publicApi = {
331
331
* // options.includePaths = [...]
332
332
* }, {
333
333
* // set optional Encore-specific options
334
- * // resolve_url_loader : true
334
+ * // resolveUrlLoader : true
335
335
* });
336
336
*
337
337
* Supported options:
338
- * * {bool} resolve_url_loader (default=true)
338
+ * * {bool} resolveUrlLoader (default=true)
339
339
* Whether or not to use the resolve-url-loader.
340
340
* Setting to false can increase performance in some
341
341
* cases, especially when using bootstrap_sass. But,
Original file line number Diff line number Diff line change @@ -45,7 +45,7 @@ class WebpackConfig {
45
45
this . useSassLoader = false ;
46
46
this . sassLoaderOptionsCallback = function ( ) { } ;
47
47
this . sassOptions = {
48
- resolve_url_loader : true
48
+ resolveUrlLoader : true
49
49
} ;
50
50
this . useLessLoader = false ;
51
51
this . lessLoaderOptionsCallback = function ( ) { } ;
@@ -251,11 +251,17 @@ class WebpackConfig {
251
251
this . sassLoaderOptionsCallback = sassLoaderOptionsCallback ;
252
252
253
253
for ( const optionKey of Object . keys ( options ) ) {
254
- if ( ! ( optionKey in this . sassOptions ) ) {
255
- throw new Error ( `Invalid option "${ optionKey } " passed to enableSassLoader(). Valid keys are ${ Object . keys ( this . sassOptions ) . join ( ', ' ) } ` ) ;
254
+ let normalizedOptionKey = optionKey ;
255
+ if ( optionKey === 'resolve_url_loader' ) {
256
+ logger . warning ( 'enableSassLoader: "resolve_url_loader" is deprecated. Please use "resolveUrlLoader" instead.' ) ;
257
+ normalizedOptionKey = 'resolveUrlLoader' ;
256
258
}
257
259
258
- this . sassOptions [ optionKey ] = options [ optionKey ] ;
260
+ if ( ! ( normalizedOptionKey in this . sassOptions ) ) {
261
+ throw new Error ( `Invalid option "${ normalizedOptionKey } " passed to enableSassLoader(). Valid keys are ${ Object . keys ( this . sassOptions ) . join ( ', ' ) } ` ) ;
262
+ }
263
+
264
+ this . sassOptions [ normalizedOptionKey ] = options [ optionKey ] ;
259
265
}
260
266
}
261
267
Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ module.exports = {
23
23
loaderFeatures . ensurePackagesExist ( 'sass' ) ;
24
24
25
25
const sassLoaders = [ ...cssLoader . getLoaders ( webpackConfig , ignorePostCssLoader ) ] ;
26
- if ( true === webpackConfig . sassOptions . resolve_url_loader ) {
26
+ if ( true === webpackConfig . sassOptions . resolveUrlLoader ) {
27
27
// responsible for resolving SASS url() paths
28
28
// without this, all url() paths must be relative to the
29
29
// entry file, not the file that contains the url()
@@ -37,7 +37,7 @@ module.exports = {
37
37
38
38
let config = Object . assign ( { } , sassOptions , {
39
39
// needed by the resolve-url-loader
40
- sourceMap : ( true === webpackConfig . sassOptions . resolve_url_loader ) || webpackConfig . useSourceMaps
40
+ sourceMap : ( true === webpackConfig . sassOptions . resolveUrlLoader ) || webpackConfig . useSourceMaps
41
41
} ) ;
42
42
43
43
// allow options to be configured
Original file line number Diff line number Diff line change @@ -346,10 +346,10 @@ describe('WebpackConfig object', () => {
346
346
347
347
it ( 'Pass valid config' , ( ) => {
348
348
const config = createConfig ( ) ;
349
- config . enableSassLoader ( ( ) => { } , { resolve_url_loader : false } ) ;
349
+ config . enableSassLoader ( ( ) => { } , { resolveUrlLoader : false } ) ;
350
350
351
351
expect ( config . useSassLoader ) . to . be . true ;
352
- expect ( config . sassOptions . resolve_url_loader ) . to . be . false ;
352
+ expect ( config . sassOptions . resolveUrlLoader ) . to . be . false ;
353
353
} ) ;
354
354
355
355
it ( 'Pass invalid config' , ( ) => {
Original file line number Diff line number Diff line change @@ -67,7 +67,7 @@ describe('loaders/sass', () => {
67
67
it ( 'getLoaders() without resolve-url-loader' , ( ) => {
68
68
const config = createConfig ( ) ;
69
69
config . enableSassLoader ( ( ) => { } , {
70
- resolve_url_loader : false ,
70
+ resolveUrlLoader : false ,
71
71
} ) ;
72
72
config . enableSourceMaps ( false ) ;
73
73
You can’t perform that action at this time.
0 commit comments