@@ -243,6 +243,60 @@ describeBuilder(buildApplication, APPLICATION_BUILDER_INFO, (harness) => {
243
243
harness . expectFile ( 'dist/browser/media/logo.svg' ) . toExist ( ) ;
244
244
} ) ;
245
245
246
+ it ( 'should rebase a URL with a hyphen-namespaced Sass variable referencing a local resource' , async ( ) => {
247
+ await harness . writeFiles ( {
248
+ 'src/styles.scss' : `@use 'theme/a';` ,
249
+ 'src/theme/a.scss' : `
250
+ @use './b' as named-hyphen;
251
+ .a {
252
+ background-image: url(named-hyphen.$my-var)
253
+ }
254
+ ` ,
255
+ 'src/theme/b.scss' : `@forward './c.scss' show $my-var;` ,
256
+ 'src/theme/c.scss' : `$my-var: "./images/logo.svg";` ,
257
+ 'src/theme/images/logo.svg' : `<svg></svg>` ,
258
+ } ) ;
259
+
260
+ harness . useTarget ( 'build' , {
261
+ ...BASE_OPTIONS ,
262
+ outputHashing : OutputHashing . None ,
263
+ styles : [ 'src/styles.scss' ] ,
264
+ } ) ;
265
+
266
+ const { result } = await harness . executeOnce ( ) ;
267
+ expect ( result ?. success ) . toBeTrue ( ) ;
268
+
269
+ harness . expectFile ( 'dist/browser/styles.css' ) . content . toContain ( `url("./media/logo.svg")` ) ;
270
+ harness . expectFile ( 'dist/browser/media/logo.svg' ) . toExist ( ) ;
271
+ } ) ;
272
+
273
+ it ( 'should rebase a URL with a underscore-namespaced Sass variable referencing a local resource' , async ( ) => {
274
+ await harness . writeFiles ( {
275
+ 'src/styles.scss' : `@use 'theme/a';` ,
276
+ 'src/theme/a.scss' : `
277
+ @use './b' as named_underscore;
278
+ .a {
279
+ background-image: url(named_underscore.$my-var)
280
+ }
281
+ ` ,
282
+ 'src/theme/b.scss' : `@forward './c.scss' show $my-var;` ,
283
+ 'src/theme/c.scss' : `$my-var: "./images/logo.svg";` ,
284
+ 'src/theme/images/logo.svg' : `<svg></svg>` ,
285
+ } ) ;
286
+
287
+ harness . useTarget ( 'build' , {
288
+ ...BASE_OPTIONS ,
289
+ outputHashing : OutputHashing . None ,
290
+ styles : [ 'src/styles.scss' ] ,
291
+ } ) ;
292
+
293
+ const { result } = await harness . executeOnce ( ) ;
294
+ expect ( result ?. success ) . toBeTrue ( ) ;
295
+
296
+ harness . expectFile ( 'dist/browser/styles.css' ) . content . toContain ( `url("./media/logo.svg")` ) ;
297
+ harness . expectFile ( 'dist/browser/media/logo.svg' ) . toExist ( ) ;
298
+ } ) ;
299
+
246
300
it ( 'should rebase a URL with a Sass variable referencing a local resource' , async ( ) => {
247
301
await harness . writeFiles ( {
248
302
'src/styles.scss' : `@use 'theme/a';` ,
0 commit comments