From 548b35650a3b14b698acb873351f2c7f15130c1c Mon Sep 17 00:00:00 2001 From: evilebottnawi Date: Tue, 10 Dec 2019 16:14:48 +0300 Subject: [PATCH] fix: handle url with backslash and newline --- src/plugins/postcss-url-parser.js | 4 + test/__snapshots__/url-option.test.js.snap | 773 +-------------------- test/fixtures/url/url.css | 10 + test/url-option.test.js | 4 +- 4 files changed, 22 insertions(+), 769 deletions(-) diff --git a/src/plugins/postcss-url-parser.js b/src/plugins/postcss-url-parser.js index 81bfbf25..c789ca98 100644 --- a/src/plugins/postcss-url-parser.js +++ b/src/plugins/postcss-url-parser.js @@ -89,6 +89,10 @@ function getUrlsFromValue(value, result, filter, decl) { if (!isStringNode && /\\["'() \t\n]/.test(normalizedUrl)) { normalizedUrl = normalizedUrl.replace(/\\(["'() \t\n])/g, '$1'); } + // https://drafts.csswg.org/css-values-4/#strings + else if (isStringNode && /\\[\n]/.test(normalizedUrl)) { + normalizedUrl = normalizedUrl.replace(/\\[\n]/g, ''); + } urls.push({ node, url: normalizedUrl, hash, needQuotes }); }); diff --git a/test/__snapshots__/url-option.test.js.snap b/test/__snapshots__/url-option.test.js.snap index edebd8e1..4e5efc03 100644 --- a/test/__snapshots__/url-option.test.js.snap +++ b/test/__snapshots__/url-option.test.js.snap @@ -1,771 +1,5 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`url option Function: errors 1`] = `Array []`; - -exports[`url option Function: module (evaluated) 1`] = ` -Array [ - Array [ - 2, - ".bar { - background: url(/webpack/public/path/img-from-imported.png); -} -", - "", - ], - Array [ - 1, - ".class { - background: url('./img.png'); -} - -.class { - background: url(\\"./img.png\\"); -} - -.class { - background: url(./img.png); -} - -.class { - background: url(\\"./img.png#hash\\"); -} - -.class { - background: url( - \\"./img.png\\" - ); -} - -.class { - background: green url( './img.png' ) xyz; -} - -.class { - background: green url( \\"./img.png\\" ) xyz; -} - -.class { - background: green url( ./img.png ) xyz; -} - -.class { - background: green url(~package/img.png) url(./other-img.png) xyz; -} - -.class { - background: green url( \\"./img img.png\\" ) xyz; -} - -.class { - background: green url( './img img.png' ) xyz; -} - -.class { - background: green url(/img.png) xyz; -} - -.class { - background: green url(data:image/png;base64,AAA) url(http://example.com/image.jpg) url(//example.com/image.png) xyz; -} - -.class { - background-image: url(\\"data:image/svg+xml;charset=utf-8,\\"); -} - -.class { - background-image: url(\\"data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20viewBox%3D%270%200%2042%2026%27%20fill%3D%27%2523007aff%27%3E%3Crect%20width%3D%274%27%20height%3D%274%27%2F%3E%3Crect%20x%3D%278%27%20y%3D%271%27%20width%3D%2734%27%20height%3D%272%27%2F%3E%3Crect%20y%3D%2711%27%20width%3D%274%27%20height%3D%274%27%2F%3E%3Crect%20x%3D%278%27%20y%3D%2712%27%20width%3D%2734%27%20height%3D%272%27%2F%3E%3Crect%20y%3D%2722%27%20width%3D%274%27%20height%3D%274%27%2F%3E%3Crect%20x%3D%278%27%20y%3D%2723%27%20width%3D%2734%27%20height%3D%272%27%2F%3E%3C%2Fsvg%3E\\"); -} - -.class { - filter: url('data:image/svg+xml;charset=utf-8,#filter'); -} - -.class { - filter: url('data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%5C%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%5C%22%3E%3Cfilter%20id%3D%5C%22filter%5C%22%3E%3CfeGaussianBlur%20in%3D%5C%22SourceAlpha%5C%22%20stdDeviation%3D%5C%220%5C%22%20%2F%3E%3CfeOffset%20dx%3D%5C%221%5C%22%20dy%3D%5C%222%5C%22%20result%3D%5C%22offsetblur%5C%22%20%2F%3E%3CfeFlood%20flood-color%3D%5C%22rgba(255%2C255%2C255%2C1)%5C%22%20%2F%3E%3CfeComposite%20in2%3D%5C%22offsetblur%5C%22%20operator%3D%5C%22in%5C%22%20%2F%3E%3CfeMerge%3E%3CfeMergeNode%20%2F%3E%3CfeMergeNode%20in%3D%5C%22SourceGraphic%5C%22%20%2F%3E%3C%2FfeMerge%3E%3C%2Ffilter%3E%3C%2Fsvg%3E%23filter'); -} - -.highlight { - filter: url(#highlight); -} - -.highlight { - filter: url('#line-marker'); -} - -@font-face { - src: url(/webpack/public/path/font.woff) format('woff'), - url(/webpack/public/path/font.woff2) format('woff2'), - url(/webpack/public/path/font.eot) format('eot'), - url(/webpack/public/path/font.ttf) format('truetype'), - url(\\"/webpack/public/path/font with spaces.eot\\") format(\\"embedded-opentype\\"), - url(/webpack/public/path/font.svg#svgFontName) format('svg'), - url(/webpack/public/path/font.woff2) format('woff2'), - url(/webpack/public/path/font.eot?#iefix) format('embedded-opentype'), - url(\\"/webpack/public/path/font with spaces.eot?#iefix\\") format('embedded-opentype'); -} - -@media (min-width: 500px) { - body { - background: url(\\"./img.png\\"); - } -} - -a { - content: \\"do not use url(path)\\"; -} - -b { - content: 'do not \\"use\\" url(path)'; -} - -@keyframes anim { - background: green url('./img.png') xyz; -} - -.a { - background-image: -webkit-image-set(url(/webpack/public/path/img1x.png) 1x, url(/webpack/public/path/img2x.png) 2x) -} - -.a { - background-image: image-set(url(/webpack/public/path/img1x.png) 1x, url(/webpack/public/path/img2x.png) 2x) -} - -.class { - background: green url() xyz; -} - -.class { - background: green url('') xyz; -} - -.class { - background: green url(\\"\\") xyz; -} - -.class { - background: green url(' ') xyz; -} - -.class { - background: green url( - ) xyz; -} - -.class { - background: green url(https://raw.githubusercontent.com/webpack/media/master/logo/icon.png) xyz; -} - -.class { - background: green url(//raw.githubusercontent.com/webpack/media/master/logo/icon.png) xyz; -} - -.class { - background: url(\\"./img.png?foo\\"); -} - -.class { - background: url(\\"./img.png?foo=bar\\"); -} - -.class { - background: url(\\"./img.png?foo=bar#hash\\"); -} - -.class { - background: url(\\"./img.png?foo=bar#hash\\"); -} - -.class { - background: url(\\"./img.png?\\"); -} - -.class { - background-image: url('./img.png') url(\\"data:image/svg+xml;charset=utf-8,\\") url('./img.png'); -} - -.class { - background: ___CSS_LOADER_URL___; - background: ___CSS_LOADER_URL___INDEX___; - background: ___CSS_LOADER_URL___99999___; - background: ___CSS_LOADER_IMPORT___; - background: ___CSS_LOADER_IMPORT___INDEX___; - background: ___CSS_LOADER_IMPORT___99999___; -} - -.pure-url { - background: url(/webpack/public/path/img-simple.png); -} - -.not-resolved { - background: url('/img-simple.png'); -} - -.above-below { - background: url(/webpack/public/path/img-simple.png); -} - -.tilde { - background: url('~package/img.png'); -} - -.aliases { - background: url('~aliasesImg/img.png') ; -} - -a { - background: url(./nested/img.png); -} - -a { - background: url(nested/img.png); -} - -@font-face { - src: url(\\"//at.alicdn.com/t/font_515771_emcns5054x3whfr.eot\\"); -} - -.class { - /* Broken */ - background-image: -webkit-image-set(); - background-image: -webkit-image-set(''); - background-image: image-set(); - background-image: image-set(''); - background-image: image-set(\\"\\"); - background-image: image-set(\\"\\" 1x); - background-image: image-set(url()); - background-image: image-set( - url() - ); - background-image: image-set(URL()); - background-image: image-set(url('')); - background-image: image-set(url(\\"\\")); - background-image: image-set(url('') 1x); - background-image: image-set(1x); - background-image: image-set( - 1x - ); - background: image-set(calc(1rem + 1px) 1x); - - /* Strings */ - background-image: -webkit-image-set(\\"/webpack/public/path/img1x.png\\" 1x, \\"/webpack/public/path/img2x.png\\" 2x); - background-image: image-set(\\"/webpack/public/path/img1x.png\\" 1x); - background-image: image-set(\\"/webpack/public/path/img1x.png\\" 1x, \\"/webpack/public/path/img2x.png\\" 2x); - background-image: image-set(\\"./img img.png\\" 1x, \\"./img img.png\\" 2x); - background-image: image-set(\\"/webpack/public/path/img1x.png\\" 1x, \\"/webpack/public/path/img2x.png\\" 2x), - image-set(\\"/webpack/public/path/img1x.png\\" 1x, \\"/webpack/public/path/img2x.png\\" 2x); - background-image: image-set( - \\"/webpack/public/path/img1x.png\\" 1x, - \\"/webpack/public/path/img2x.png\\" 2x, - \\"/webpack/public/path/img3x.png\\" 600dpi - ); - background-image: image-set(\\"/webpack/public/path/img1x.png\\" 1x); - background-image: image-set(\\"/webpack/public/path/img1x.png#hash\\" 1x); - background-image: image-set(\\"/webpack/public/path/img1x.png?#iefix\\" 1x); - - /* With \`url\` function */ - background-image: -webkit-image-set(url(/webpack/public/path/img1x.png) 1x, url(/webpack/public/path/img2x.png) 2x); - background-image: -webkit-image-set(url(/webpack/public/path/img1x.png) 1x); - background-image: -webkit-image-set( - url(/webpack/public/path/img1x.png) 1x - ); - background-image: image-set(url(/webpack/public/path/img1x.png) 1x); - background-image: image-set( - url(/webpack/public/path/img1x.png) 1x - ); - background-image: image-set(url(/webpack/public/path/img1x.png) 1x, url(/webpack/public/path/img2x.png) 2x); - background-image: image-set( - url(/webpack/public/path/img1x.png) 1x, - url(/webpack/public/path/img2x.png) 2x, - url(/webpack/public/path/img3x.png) 600dpi - ); - background-image: image-set(url(\\"./img img.png\\") 1x, url(\\"./img img.png\\") 2x); - - background-image: image-set(url(/webpack/public/path/img1x.png) 1x, \\"/webpack/public/path/img2x.png\\" 2x); -} - -.class { - /* Not allowed on windows */ - /* background: url(./img\\\\\\"img.png); */ - background: url(./img\\\\'img.png); - background: url(./img\\\\'\\\\'\\\\'img.png); - background: url(./img\\\\(img.png); - background: url(./img\\\\)img.png); - background: url(./img\\\\ img.png); - background: url(./img\\\\'\\\\(\\\\)\\\\ img.png); - - background-image: image-set( - /* Not allowed on windows */ - /* url(./img\\\\\\"img.png) 1x, */ - url(./img\\\\'\\\\'\\\\'img.png) 2x, - url(./img\\\\'img.png) 3x, - url(./img\\\\(img.png) 4x, - url(./img\\\\)img.png) 5x, - url(./img\\\\ img.png) 6x, - url(./img\\\\'\\\\(\\\\)\\\\ img.png) 7x - ); -} - -.class-class-class { - background: url(\\"./img'''img.png\\"); - background: url(\\"./img'() img.png\\"); - background: url(\\"./img'img.png\\"); - background: url(\\"./img(img.png\\"); - background: url(\\"./img)img.png\\"); - background: url('./img img.png'); - background: url(\\"./img img.png\\"); -} -", - "", - ], -] -`; - -exports[`url option Function: module 1`] = ` -"// Imports -var ___CSS_LOADER_API_IMPORT___ = require(\\"../../../src/runtime/api.js\\"); -var ___CSS_LOADER_AT_RULE_IMPORT_0___ = require(\\"-!../../../src/index.js??ref--4-0!./imported.css\\"); -var ___CSS_LOADER_GET_URL_IMPORT___ = require(\\"../../../src/runtime/getUrl.js\\"); -var ___CSS_LOADER_URL_PURE_IMPORT_0___ = require(\\"./font.woff\\"); -var ___CSS_LOADER_URL_PURE_IMPORT_1___ = require(\\"./font.woff2\\"); -var ___CSS_LOADER_URL_PURE_IMPORT_2___ = require(\\"./font.eot\\"); -var ___CSS_LOADER_URL_PURE_IMPORT_3___ = require(\\"package/font.ttf\\"); -var ___CSS_LOADER_URL_PURE_IMPORT_4___ = require(\\"./font with spaces.eot\\"); -var ___CSS_LOADER_URL_PURE_IMPORT_5___ = require(\\"./font.svg\\"); -var ___CSS_LOADER_URL_PURE_IMPORT_6___ = require(\\"./font.woff2?foo=bar\\"); -var ___CSS_LOADER_URL_PURE_IMPORT_9___ = require(\\"./img1x.png\\"); -var ___CSS_LOADER_URL_PURE_IMPORT_10___ = require(\\"./img2x.png\\"); -var ___CSS_LOADER_URL_PURE_IMPORT_11___ = require(\\"./img-simple.png\\"); -var ___CSS_LOADER_URL_PURE_IMPORT_12___ = require(\\"../url/img-simple.png\\"); -var ___CSS_LOADER_URL_PURE_IMPORT_15___ = require(\\"./img3x.png\\"); -var ___CSS_LOADER_URL_PURE_IMPORT_16___ = require(\\"./img1x.png?foo=bar\\"); -exports = module.exports = ___CSS_LOADER_API_IMPORT___(false); -exports.i(___CSS_LOADER_AT_RULE_IMPORT_0___); -var ___CSS_LOADER_URL_IMPORT_0___ = ___CSS_LOADER_GET_URL_IMPORT___(___CSS_LOADER_URL_PURE_IMPORT_0___); -var ___CSS_LOADER_URL_IMPORT_1___ = ___CSS_LOADER_GET_URL_IMPORT___(___CSS_LOADER_URL_PURE_IMPORT_1___); -var ___CSS_LOADER_URL_IMPORT_2___ = ___CSS_LOADER_GET_URL_IMPORT___(___CSS_LOADER_URL_PURE_IMPORT_2___); -var ___CSS_LOADER_URL_IMPORT_3___ = ___CSS_LOADER_GET_URL_IMPORT___(___CSS_LOADER_URL_PURE_IMPORT_3___); -var ___CSS_LOADER_URL_IMPORT_4___ = ___CSS_LOADER_GET_URL_IMPORT___(___CSS_LOADER_URL_PURE_IMPORT_4___); -var ___CSS_LOADER_URL_IMPORT_5___ = ___CSS_LOADER_GET_URL_IMPORT___(___CSS_LOADER_URL_PURE_IMPORT_5___, { hash: \\"#svgFontName\\" }); -var ___CSS_LOADER_URL_IMPORT_6___ = ___CSS_LOADER_GET_URL_IMPORT___(___CSS_LOADER_URL_PURE_IMPORT_6___); -var ___CSS_LOADER_URL_IMPORT_7___ = ___CSS_LOADER_GET_URL_IMPORT___(___CSS_LOADER_URL_PURE_IMPORT_2___, { hash: \\"?#iefix\\" }); -var ___CSS_LOADER_URL_IMPORT_8___ = ___CSS_LOADER_GET_URL_IMPORT___(___CSS_LOADER_URL_PURE_IMPORT_4___, { hash: \\"?#iefix\\" }); -var ___CSS_LOADER_URL_IMPORT_9___ = ___CSS_LOADER_GET_URL_IMPORT___(___CSS_LOADER_URL_PURE_IMPORT_9___); -var ___CSS_LOADER_URL_IMPORT_10___ = ___CSS_LOADER_GET_URL_IMPORT___(___CSS_LOADER_URL_PURE_IMPORT_10___); -var ___CSS_LOADER_URL_IMPORT_11___ = ___CSS_LOADER_GET_URL_IMPORT___(___CSS_LOADER_URL_PURE_IMPORT_11___); -var ___CSS_LOADER_URL_IMPORT_12___ = ___CSS_LOADER_GET_URL_IMPORT___(___CSS_LOADER_URL_PURE_IMPORT_12___); -var ___CSS_LOADER_URL_IMPORT_13___ = ___CSS_LOADER_GET_URL_IMPORT___(___CSS_LOADER_URL_PURE_IMPORT_9___, { needQuotes: true }); -var ___CSS_LOADER_URL_IMPORT_14___ = ___CSS_LOADER_GET_URL_IMPORT___(___CSS_LOADER_URL_PURE_IMPORT_10___, { needQuotes: true }); -var ___CSS_LOADER_URL_IMPORT_15___ = ___CSS_LOADER_GET_URL_IMPORT___(___CSS_LOADER_URL_PURE_IMPORT_15___, { needQuotes: true }); -var ___CSS_LOADER_URL_IMPORT_16___ = ___CSS_LOADER_GET_URL_IMPORT___(___CSS_LOADER_URL_PURE_IMPORT_16___, { needQuotes: true }); -var ___CSS_LOADER_URL_IMPORT_17___ = ___CSS_LOADER_GET_URL_IMPORT___(___CSS_LOADER_URL_PURE_IMPORT_9___, { hash: \\"#hash\\", needQuotes: true }); -var ___CSS_LOADER_URL_IMPORT_18___ = ___CSS_LOADER_GET_URL_IMPORT___(___CSS_LOADER_URL_PURE_IMPORT_9___, { hash: \\"?#iefix\\", needQuotes: true }); -var ___CSS_LOADER_URL_IMPORT_19___ = ___CSS_LOADER_GET_URL_IMPORT___(___CSS_LOADER_URL_PURE_IMPORT_15___); -// Module -exports.push([module.id, \\".class {\\\\n background: url('./img.png');\\\\n}\\\\n\\\\n.class {\\\\n background: url(\\\\\\"./img.png\\\\\\");\\\\n}\\\\n\\\\n.class {\\\\n background: url(./img.png);\\\\n}\\\\n\\\\n.class {\\\\n background: url(\\\\\\"./img.png#hash\\\\\\");\\\\n}\\\\n\\\\n.class {\\\\n background: url(\\\\n \\\\\\"./img.png\\\\\\"\\\\n );\\\\n}\\\\n\\\\n.class {\\\\n background: green url( './img.png' ) xyz;\\\\n}\\\\n\\\\n.class {\\\\n background: green url( \\\\\\"./img.png\\\\\\" ) xyz;\\\\n}\\\\n\\\\n.class {\\\\n background: green url( ./img.png ) xyz;\\\\n}\\\\n\\\\n.class {\\\\n background: green url(~package/img.png) url(./other-img.png) xyz;\\\\n}\\\\n\\\\n.class {\\\\n background: green url( \\\\\\"./img img.png\\\\\\" ) xyz;\\\\n}\\\\n\\\\n.class {\\\\n background: green url( './img img.png' ) xyz;\\\\n}\\\\n\\\\n.class {\\\\n background: green url(/img.png) xyz;\\\\n}\\\\n\\\\n.class {\\\\n background: green url(data:image/png;base64,AAA) url(http://example.com/image.jpg) url(//example.com/image.png) xyz;\\\\n}\\\\n\\\\n.class {\\\\n background-image: url(\\\\\\"data:image/svg+xml;charset=utf-8,\\\\\\");\\\\n}\\\\n\\\\n.class {\\\\n background-image: url(\\\\\\"data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20viewBox%3D%270%200%2042%2026%27%20fill%3D%27%2523007aff%27%3E%3Crect%20width%3D%274%27%20height%3D%274%27%2F%3E%3Crect%20x%3D%278%27%20y%3D%271%27%20width%3D%2734%27%20height%3D%272%27%2F%3E%3Crect%20y%3D%2711%27%20width%3D%274%27%20height%3D%274%27%2F%3E%3Crect%20x%3D%278%27%20y%3D%2712%27%20width%3D%2734%27%20height%3D%272%27%2F%3E%3Crect%20y%3D%2722%27%20width%3D%274%27%20height%3D%274%27%2F%3E%3Crect%20x%3D%278%27%20y%3D%2723%27%20width%3D%2734%27%20height%3D%272%27%2F%3E%3C%2Fsvg%3E\\\\\\");\\\\n}\\\\n\\\\n.class {\\\\n filter: url('data:image/svg+xml;charset=utf-8,#filter');\\\\n}\\\\n\\\\n.class {\\\\n filter: url('data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%5C%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%5C%22%3E%3Cfilter%20id%3D%5C%22filter%5C%22%3E%3CfeGaussianBlur%20in%3D%5C%22SourceAlpha%5C%22%20stdDeviation%3D%5C%220%5C%22%20%2F%3E%3CfeOffset%20dx%3D%5C%221%5C%22%20dy%3D%5C%222%5C%22%20result%3D%5C%22offsetblur%5C%22%20%2F%3E%3CfeFlood%20flood-color%3D%5C%22rgba(255%2C255%2C255%2C1)%5C%22%20%2F%3E%3CfeComposite%20in2%3D%5C%22offsetblur%5C%22%20operator%3D%5C%22in%5C%22%20%2F%3E%3CfeMerge%3E%3CfeMergeNode%20%2F%3E%3CfeMergeNode%20in%3D%5C%22SourceGraphic%5C%22%20%2F%3E%3C%2FfeMerge%3E%3C%2Ffilter%3E%3C%2Fsvg%3E%23filter');\\\\n}\\\\n\\\\n.highlight {\\\\n filter: url(#highlight);\\\\n}\\\\n\\\\n.highlight {\\\\n filter: url('#line-marker');\\\\n}\\\\n\\\\n@font-face {\\\\n src: url(\\" + ___CSS_LOADER_URL_IMPORT_0___ + \\") format('woff'),\\\\n url(\\" + ___CSS_LOADER_URL_IMPORT_1___ + \\") format('woff2'),\\\\n url(\\" + ___CSS_LOADER_URL_IMPORT_2___ + \\") format('eot'),\\\\n url(\\" + ___CSS_LOADER_URL_IMPORT_3___ + \\") format('truetype'),\\\\n url(\\" + ___CSS_LOADER_URL_IMPORT_4___ + \\") format(\\\\\\"embedded-opentype\\\\\\"),\\\\n url(\\" + ___CSS_LOADER_URL_IMPORT_5___ + \\") format('svg'),\\\\n url(\\" + ___CSS_LOADER_URL_IMPORT_6___ + \\") format('woff2'),\\\\n url(\\" + ___CSS_LOADER_URL_IMPORT_7___ + \\") format('embedded-opentype'),\\\\n url(\\" + ___CSS_LOADER_URL_IMPORT_8___ + \\") format('embedded-opentype');\\\\n}\\\\n\\\\n@media (min-width: 500px) {\\\\n body {\\\\n background: url(\\\\\\"./img.png\\\\\\");\\\\n }\\\\n}\\\\n\\\\na {\\\\n content: \\\\\\"do not use url(path)\\\\\\";\\\\n}\\\\n\\\\nb {\\\\n content: 'do not \\\\\\"use\\\\\\" url(path)';\\\\n}\\\\n\\\\n@keyframes anim {\\\\n background: green url('./img.png') xyz;\\\\n}\\\\n\\\\n.a {\\\\n background-image: -webkit-image-set(url(\\" + ___CSS_LOADER_URL_IMPORT_9___ + \\") 1x, url(\\" + ___CSS_LOADER_URL_IMPORT_10___ + \\") 2x)\\\\n}\\\\n\\\\n.a {\\\\n background-image: image-set(url(\\" + ___CSS_LOADER_URL_IMPORT_9___ + \\") 1x, url(\\" + ___CSS_LOADER_URL_IMPORT_10___ + \\") 2x)\\\\n}\\\\n\\\\n.class {\\\\n background: green url() xyz;\\\\n}\\\\n\\\\n.class {\\\\n background: green url('') xyz;\\\\n}\\\\n\\\\n.class {\\\\n background: green url(\\\\\\"\\\\\\") xyz;\\\\n}\\\\n\\\\n.class {\\\\n background: green url(' ') xyz;\\\\n}\\\\n\\\\n.class {\\\\n background: green url(\\\\n ) xyz;\\\\n}\\\\n\\\\n.class {\\\\n background: green url(https://raw.githubusercontent.com/webpack/media/master/logo/icon.png) xyz;\\\\n}\\\\n\\\\n.class {\\\\n background: green url(//raw.githubusercontent.com/webpack/media/master/logo/icon.png) xyz;\\\\n}\\\\n\\\\n.class {\\\\n background: url(\\\\\\"./img.png?foo\\\\\\");\\\\n}\\\\n\\\\n.class {\\\\n background: url(\\\\\\"./img.png?foo=bar\\\\\\");\\\\n}\\\\n\\\\n.class {\\\\n background: url(\\\\\\"./img.png?foo=bar#hash\\\\\\");\\\\n}\\\\n\\\\n.class {\\\\n background: url(\\\\\\"./img.png?foo=bar#hash\\\\\\");\\\\n}\\\\n\\\\n.class {\\\\n background: url(\\\\\\"./img.png?\\\\\\");\\\\n}\\\\n\\\\n.class {\\\\n background-image: url('./img.png') url(\\\\\\"data:image/svg+xml;charset=utf-8,\\\\\\") url('./img.png');\\\\n}\\\\n\\\\n.class {\\\\n background: ___CSS_LOADER_URL___;\\\\n background: ___CSS_LOADER_URL___INDEX___;\\\\n background: ___CSS_LOADER_URL___99999___;\\\\n background: ___CSS_LOADER_IMPORT___;\\\\n background: ___CSS_LOADER_IMPORT___INDEX___;\\\\n background: ___CSS_LOADER_IMPORT___99999___;\\\\n}\\\\n\\\\n.pure-url {\\\\n background: url(\\" + ___CSS_LOADER_URL_IMPORT_11___ + \\");\\\\n}\\\\n\\\\n.not-resolved {\\\\n background: url('/img-simple.png');\\\\n}\\\\n\\\\n.above-below {\\\\n background: url(\\" + ___CSS_LOADER_URL_IMPORT_12___ + \\");\\\\n}\\\\n\\\\n.tilde {\\\\n background: url('~package/img.png');\\\\n}\\\\n\\\\n.aliases {\\\\n background: url('~aliasesImg/img.png') ;\\\\n}\\\\n\\\\na {\\\\n background: url(./nested/img.png);\\\\n}\\\\n\\\\na {\\\\n background: url(nested/img.png);\\\\n}\\\\n\\\\n@font-face {\\\\n src: url(\\\\\\"//at.alicdn.com/t/font_515771_emcns5054x3whfr.eot\\\\\\");\\\\n}\\\\n\\\\n.class {\\\\n /* Broken */\\\\n background-image: -webkit-image-set();\\\\n background-image: -webkit-image-set('');\\\\n background-image: image-set();\\\\n background-image: image-set('');\\\\n background-image: image-set(\\\\\\"\\\\\\");\\\\n background-image: image-set(\\\\\\"\\\\\\" 1x);\\\\n background-image: image-set(url());\\\\n background-image: image-set(\\\\n url()\\\\n );\\\\n background-image: image-set(URL());\\\\n background-image: image-set(url(''));\\\\n background-image: image-set(url(\\\\\\"\\\\\\"));\\\\n background-image: image-set(url('') 1x);\\\\n background-image: image-set(1x);\\\\n background-image: image-set(\\\\n 1x\\\\n );\\\\n background: image-set(calc(1rem + 1px) 1x);\\\\n\\\\n /* Strings */\\\\n background-image: -webkit-image-set(\\" + ___CSS_LOADER_URL_IMPORT_13___ + \\" 1x, \\" + ___CSS_LOADER_URL_IMPORT_14___ + \\" 2x);\\\\n background-image: image-set(\\" + ___CSS_LOADER_URL_IMPORT_13___ + \\" 1x);\\\\n background-image: image-set(\\" + ___CSS_LOADER_URL_IMPORT_13___ + \\" 1x, \\" + ___CSS_LOADER_URL_IMPORT_14___ + \\" 2x);\\\\n background-image: image-set(\\\\\\"./img img.png\\\\\\" 1x, \\\\\\"./img img.png\\\\\\" 2x);\\\\n background-image: image-set(\\" + ___CSS_LOADER_URL_IMPORT_13___ + \\" 1x, \\" + ___CSS_LOADER_URL_IMPORT_14___ + \\" 2x),\\\\n image-set(\\" + ___CSS_LOADER_URL_IMPORT_13___ + \\" 1x, \\" + ___CSS_LOADER_URL_IMPORT_14___ + \\" 2x);\\\\n background-image: image-set(\\\\n \\" + ___CSS_LOADER_URL_IMPORT_13___ + \\" 1x,\\\\n \\" + ___CSS_LOADER_URL_IMPORT_14___ + \\" 2x,\\\\n \\" + ___CSS_LOADER_URL_IMPORT_15___ + \\" 600dpi\\\\n );\\\\n background-image: image-set(\\" + ___CSS_LOADER_URL_IMPORT_16___ + \\" 1x);\\\\n background-image: image-set(\\" + ___CSS_LOADER_URL_IMPORT_17___ + \\" 1x);\\\\n background-image: image-set(\\" + ___CSS_LOADER_URL_IMPORT_18___ + \\" 1x);\\\\n\\\\n /* With \`url\` function */\\\\n background-image: -webkit-image-set(url(\\" + ___CSS_LOADER_URL_IMPORT_9___ + \\") 1x, url(\\" + ___CSS_LOADER_URL_IMPORT_10___ + \\") 2x);\\\\n background-image: -webkit-image-set(url(\\" + ___CSS_LOADER_URL_IMPORT_9___ + \\") 1x);\\\\n background-image: -webkit-image-set(\\\\n url(\\" + ___CSS_LOADER_URL_IMPORT_9___ + \\") 1x\\\\n );\\\\n background-image: image-set(url(\\" + ___CSS_LOADER_URL_IMPORT_9___ + \\") 1x);\\\\n background-image: image-set(\\\\n url(\\" + ___CSS_LOADER_URL_IMPORT_9___ + \\") 1x\\\\n );\\\\n background-image: image-set(url(\\" + ___CSS_LOADER_URL_IMPORT_9___ + \\") 1x, url(\\" + ___CSS_LOADER_URL_IMPORT_10___ + \\") 2x);\\\\n background-image: image-set(\\\\n url(\\" + ___CSS_LOADER_URL_IMPORT_9___ + \\") 1x,\\\\n url(\\" + ___CSS_LOADER_URL_IMPORT_10___ + \\") 2x,\\\\n url(\\" + ___CSS_LOADER_URL_IMPORT_19___ + \\") 600dpi\\\\n );\\\\n background-image: image-set(url(\\\\\\"./img img.png\\\\\\") 1x, url(\\\\\\"./img img.png\\\\\\") 2x);\\\\n\\\\n background-image: image-set(url(\\" + ___CSS_LOADER_URL_IMPORT_9___ + \\") 1x, \\" + ___CSS_LOADER_URL_IMPORT_14___ + \\" 2x);\\\\n}\\\\n\\\\n.class {\\\\n /* Not allowed on windows */\\\\n /* background: url(./img\\\\\\\\\\\\\\"img.png); */\\\\n background: url(./img\\\\\\\\'img.png);\\\\n background: url(./img\\\\\\\\'\\\\\\\\'\\\\\\\\'img.png);\\\\n background: url(./img\\\\\\\\(img.png);\\\\n background: url(./img\\\\\\\\)img.png);\\\\n background: url(./img\\\\\\\\ img.png);\\\\n background: url(./img\\\\\\\\'\\\\\\\\(\\\\\\\\)\\\\\\\\ img.png);\\\\n\\\\n background-image: image-set(\\\\n /* Not allowed on windows */\\\\n /* url(./img\\\\\\\\\\\\\\"img.png) 1x, */\\\\n url(./img\\\\\\\\'\\\\\\\\'\\\\\\\\'img.png) 2x,\\\\n url(./img\\\\\\\\'img.png) 3x,\\\\n url(./img\\\\\\\\(img.png) 4x,\\\\n url(./img\\\\\\\\)img.png) 5x,\\\\n url(./img\\\\\\\\ img.png) 6x,\\\\n url(./img\\\\\\\\'\\\\\\\\(\\\\\\\\)\\\\\\\\ img.png) 7x\\\\n );\\\\n}\\\\n\\\\n.class-class-class {\\\\n background: url(\\\\\\"./img'''img.png\\\\\\");\\\\n background: url(\\\\\\"./img'() img.png\\\\\\");\\\\n background: url(\\\\\\"./img'img.png\\\\\\");\\\\n background: url(\\\\\\"./img(img.png\\\\\\");\\\\n background: url(\\\\\\"./img)img.png\\\\\\");\\\\n background: url('./img img.png');\\\\n background: url(\\\\\\"./img img.png\\\\\\");\\\\n}\\\\n\\", \\"\\"]); -" -`; - -exports[`url option Function: warnings 1`] = ` -Array [ - "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning - -(120:3) Unable to find uri in 'background: green url() xyz'", - "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning - -(124:3) Unable to find uri in 'background: green url('') xyz'", - "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning - -(128:3) Unable to find uri in 'background: green url(\\"\\") xyz'", - "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning - -(132:3) Unable to find uri in 'background: green url(' ') xyz'", - "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning - -(136:3) Unable to find uri in 'background: green url( - ) xyz'", - "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning - -(216:3) Unable to find uri in 'background-image: -webkit-image-set('')'", - "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning - -(218:3) Unable to find uri in 'background-image: image-set('')'", - "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning - -(219:3) Unable to find uri in 'background-image: image-set(\\"\\")'", - "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning - -(220:3) Unable to find uri in 'background-image: image-set(\\"\\" 1x)'", - "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning - -(221:3) Unable to find uri in 'background-image: image-set(url())'", - "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning - -(222:3) Unable to find uri in 'background-image: image-set( - url() - )'", - "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning - -(225:3) Unable to find uri in 'background-image: image-set(URL())'", - "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning - -(226:3) Unable to find uri in 'background-image: image-set(url(''))'", - "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning - -(227:3) Unable to find uri in 'background-image: image-set(url(\\"\\"))'", - "ModuleWarning: Module Warning (from \`replaced original path\`): -Warning - -(228:3) Unable to find uri in 'background-image: image-set(url('') 1x)'", -] -`; - -exports[`url option false: errors 1`] = `Array []`; - -exports[`url option false: module (evaluated) 1`] = ` -Array [ - Array [ - 2, - ".bar { - background: url('./img-from-imported.png'); -} -", - "", - ], - Array [ - 1, - ".class { - background: url('./img.png'); -} - -.class { - background: url(\\"./img.png\\"); -} - -.class { - background: url(./img.png); -} - -.class { - background: url(\\"./img.png#hash\\"); -} - -.class { - background: url( - \\"./img.png\\" - ); -} - -.class { - background: green url( './img.png' ) xyz; -} - -.class { - background: green url( \\"./img.png\\" ) xyz; -} - -.class { - background: green url( ./img.png ) xyz; -} - -.class { - background: green url(~package/img.png) url(./other-img.png) xyz; -} - -.class { - background: green url( \\"./img img.png\\" ) xyz; -} - -.class { - background: green url( './img img.png' ) xyz; -} - -.class { - background: green url(/img.png) xyz; -} - -.class { - background: green url(data:image/png;base64,AAA) url(http://example.com/image.jpg) url(//example.com/image.png) xyz; -} - -.class { - background-image: url(\\"data:image/svg+xml;charset=utf-8,\\"); -} - -.class { - background-image: url(\\"data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20viewBox%3D%270%200%2042%2026%27%20fill%3D%27%2523007aff%27%3E%3Crect%20width%3D%274%27%20height%3D%274%27%2F%3E%3Crect%20x%3D%278%27%20y%3D%271%27%20width%3D%2734%27%20height%3D%272%27%2F%3E%3Crect%20y%3D%2711%27%20width%3D%274%27%20height%3D%274%27%2F%3E%3Crect%20x%3D%278%27%20y%3D%2712%27%20width%3D%2734%27%20height%3D%272%27%2F%3E%3Crect%20y%3D%2722%27%20width%3D%274%27%20height%3D%274%27%2F%3E%3Crect%20x%3D%278%27%20y%3D%2723%27%20width%3D%2734%27%20height%3D%272%27%2F%3E%3C%2Fsvg%3E\\"); -} - -.class { - filter: url('data:image/svg+xml;charset=utf-8,#filter'); -} - -.class { - filter: url('data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%5C%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%5C%22%3E%3Cfilter%20id%3D%5C%22filter%5C%22%3E%3CfeGaussianBlur%20in%3D%5C%22SourceAlpha%5C%22%20stdDeviation%3D%5C%220%5C%22%20%2F%3E%3CfeOffset%20dx%3D%5C%221%5C%22%20dy%3D%5C%222%5C%22%20result%3D%5C%22offsetblur%5C%22%20%2F%3E%3CfeFlood%20flood-color%3D%5C%22rgba(255%2C255%2C255%2C1)%5C%22%20%2F%3E%3CfeComposite%20in2%3D%5C%22offsetblur%5C%22%20operator%3D%5C%22in%5C%22%20%2F%3E%3CfeMerge%3E%3CfeMergeNode%20%2F%3E%3CfeMergeNode%20in%3D%5C%22SourceGraphic%5C%22%20%2F%3E%3C%2FfeMerge%3E%3C%2Ffilter%3E%3C%2Fsvg%3E%23filter'); -} - -.highlight { - filter: url(#highlight); -} - -.highlight { - filter: url('#line-marker'); -} - -@font-face { - src: url(./font.woff) format('woff'), - url('./font.woff2') format('woff2'), - url(\\"./font.eot\\") format('eot'), - url(~package/font.ttf) format('truetype'), - url(\\"./font with spaces.eot\\") format(\\"embedded-opentype\\"), - url('./font.svg#svgFontName') format('svg'), - url('./font.woff2?foo=bar') format('woff2'), - url(\\"./font.eot?#iefix\\") format('embedded-opentype'), - url(\\"./font with spaces.eot?#iefix\\") format('embedded-opentype'); -} - -@media (min-width: 500px) { - body { - background: url(\\"./img.png\\"); - } -} - -a { - content: \\"do not use url(path)\\"; -} - -b { - content: 'do not \\"use\\" url(path)'; -} - -@keyframes anim { - background: green url('./img.png') xyz; -} - -.a { - background-image: -webkit-image-set(url('./img1x.png') 1x, url('./img2x.png') 2x) -} - -.a { - background-image: image-set(url('./img1x.png') 1x, url('./img2x.png') 2x) -} - -.class { - background: green url() xyz; -} - -.class { - background: green url('') xyz; -} - -.class { - background: green url(\\"\\") xyz; -} - -.class { - background: green url(' ') xyz; -} - -.class { - background: green url( - ) xyz; -} - -.class { - background: green url(https://raw.githubusercontent.com/webpack/media/master/logo/icon.png) xyz; -} - -.class { - background: green url(//raw.githubusercontent.com/webpack/media/master/logo/icon.png) xyz; -} - -.class { - background: url(\\"./img.png?foo\\"); -} - -.class { - background: url(\\"./img.png?foo=bar\\"); -} - -.class { - background: url(\\"./img.png?foo=bar#hash\\"); -} - -.class { - background: url(\\"./img.png?foo=bar#hash\\"); -} - -.class { - background: url(\\"./img.png?\\"); -} - -.class { - background-image: url('./img.png') url(\\"data:image/svg+xml;charset=utf-8,\\") url('./img.png'); -} - -.class { - background: ___CSS_LOADER_URL___; - background: ___CSS_LOADER_URL___INDEX___; - background: ___CSS_LOADER_URL___99999___; - background: ___CSS_LOADER_IMPORT___; - background: ___CSS_LOADER_IMPORT___INDEX___; - background: ___CSS_LOADER_IMPORT___99999___; -} - -.pure-url { - background: url('img-simple.png'); -} - -.not-resolved { - background: url('/img-simple.png'); -} - -.above-below { - background: url('../url/img-simple.png'); -} - -.tilde { - background: url('~package/img.png'); -} - -.aliases { - background: url('~aliasesImg/img.png') ; -} - -a { - background: url(./nested/img.png); -} - -a { - background: url(nested/img.png); -} - -@font-face { - src: url(\\"//at.alicdn.com/t/font_515771_emcns5054x3whfr.eot\\"); -} - -.class { - /* Broken */ - background-image: -webkit-image-set(); - background-image: -webkit-image-set(''); - background-image: image-set(); - background-image: image-set(''); - background-image: image-set(\\"\\"); - background-image: image-set(\\"\\" 1x); - background-image: image-set(url()); - background-image: image-set( - url() - ); - background-image: image-set(URL()); - background-image: image-set(url('')); - background-image: image-set(url(\\"\\")); - background-image: image-set(url('') 1x); - background-image: image-set(1x); - background-image: image-set( - 1x - ); - background: image-set(calc(1rem + 1px) 1x); - - /* Strings */ - background-image: -webkit-image-set(\\"./img1x.png\\" 1x, \\"./img2x.png\\" 2x); - background-image: image-set(\\"./img1x.png\\" 1x); - background-image: image-set(\\"./img1x.png\\" 1x, \\"./img2x.png\\" 2x); - background-image: image-set(\\"./img img.png\\" 1x, \\"./img img.png\\" 2x); - background-image: image-set(\\"./img1x.png\\" 1x, \\"./img2x.png\\" 2x), - image-set(\\"./img1x.png\\" 1x, \\"./img2x.png\\" 2x); - background-image: image-set( - \\"./img1x.png\\" 1x, - \\"./img2x.png\\" 2x, - \\"./img3x.png\\" 600dpi - ); - background-image: image-set(\\"./img1x.png?foo=bar\\" 1x); - background-image: image-set(\\"./img1x.png#hash\\" 1x); - background-image: image-set(\\"./img1x.png?#iefix\\" 1x); - - /* With \`url\` function */ - background-image: -webkit-image-set(url(\\"./img1x.png\\") 1x, url(\\"./img2x.png\\") 2x); - background-image: -webkit-image-set(url(\\"./img1x.png\\") 1x); - background-image: -webkit-image-set( - url(\\"./img1x.png\\") 1x - ); - background-image: image-set(url(./img1x.png) 1x); - background-image: image-set( - url(./img1x.png) 1x - ); - background-image: image-set(url(\\"./img1x.png\\") 1x, url(\\"./img2x.png\\") 2x); - background-image: image-set( - url(./img1x.png) 1x, - url(./img2x.png) 2x, - url(./img3x.png) 600dpi - ); - background-image: image-set(url(\\"./img img.png\\") 1x, url(\\"./img img.png\\") 2x); - - background-image: image-set(url(\\"./img1x.png\\") 1x, \\"./img2x.png\\" 2x); -} - -.class { - /* Not allowed on windows */ - /* background: url(./img\\\\\\"img.png); */ - background: url(./img\\\\'img.png); - background: url(./img\\\\'\\\\'\\\\'img.png); - background: url(./img\\\\(img.png); - background: url(./img\\\\)img.png); - background: url(./img\\\\ img.png); - background: url(./img\\\\'\\\\(\\\\)\\\\ img.png); - - background-image: image-set( - /* Not allowed on windows */ - /* url(./img\\\\\\"img.png) 1x, */ - url(./img\\\\'\\\\'\\\\'img.png) 2x, - url(./img\\\\'img.png) 3x, - url(./img\\\\(img.png) 4x, - url(./img\\\\)img.png) 5x, - url(./img\\\\ img.png) 6x, - url(./img\\\\'\\\\(\\\\)\\\\ img.png) 7x - ); -} - -.class-class-class { - background: url(\\"./img'''img.png\\"); - background: url(\\"./img'() img.png\\"); - background: url(\\"./img'img.png\\"); - background: url(\\"./img(img.png\\"); - background: url(\\"./img)img.png\\"); - background: url('./img img.png'); - background: url(\\"./img img.png\\"); -} -", - "", - ], -] -`; - -exports[`url option false: module 1`] = ` -"// Imports -var ___CSS_LOADER_API_IMPORT___ = require(\\"../../../src/runtime/api.js\\"); -var ___CSS_LOADER_AT_RULE_IMPORT_0___ = require(\\"-!../../../src/index.js??ref--4-0!./imported.css\\"); -exports = module.exports = ___CSS_LOADER_API_IMPORT___(false); -exports.i(___CSS_LOADER_AT_RULE_IMPORT_0___); -// Module -exports.push([module.id, \\".class {\\\\n background: url('./img.png');\\\\n}\\\\n\\\\n.class {\\\\n background: url(\\\\\\"./img.png\\\\\\");\\\\n}\\\\n\\\\n.class {\\\\n background: url(./img.png);\\\\n}\\\\n\\\\n.class {\\\\n background: url(\\\\\\"./img.png#hash\\\\\\");\\\\n}\\\\n\\\\n.class {\\\\n background: url(\\\\n \\\\\\"./img.png\\\\\\"\\\\n );\\\\n}\\\\n\\\\n.class {\\\\n background: green url( './img.png' ) xyz;\\\\n}\\\\n\\\\n.class {\\\\n background: green url( \\\\\\"./img.png\\\\\\" ) xyz;\\\\n}\\\\n\\\\n.class {\\\\n background: green url( ./img.png ) xyz;\\\\n}\\\\n\\\\n.class {\\\\n background: green url(~package/img.png) url(./other-img.png) xyz;\\\\n}\\\\n\\\\n.class {\\\\n background: green url( \\\\\\"./img img.png\\\\\\" ) xyz;\\\\n}\\\\n\\\\n.class {\\\\n background: green url( './img img.png' ) xyz;\\\\n}\\\\n\\\\n.class {\\\\n background: green url(/img.png) xyz;\\\\n}\\\\n\\\\n.class {\\\\n background: green url(data:image/png;base64,AAA) url(http://example.com/image.jpg) url(//example.com/image.png) xyz;\\\\n}\\\\n\\\\n.class {\\\\n background-image: url(\\\\\\"data:image/svg+xml;charset=utf-8,\\\\\\");\\\\n}\\\\n\\\\n.class {\\\\n background-image: url(\\\\\\"data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20viewBox%3D%270%200%2042%2026%27%20fill%3D%27%2523007aff%27%3E%3Crect%20width%3D%274%27%20height%3D%274%27%2F%3E%3Crect%20x%3D%278%27%20y%3D%271%27%20width%3D%2734%27%20height%3D%272%27%2F%3E%3Crect%20y%3D%2711%27%20width%3D%274%27%20height%3D%274%27%2F%3E%3Crect%20x%3D%278%27%20y%3D%2712%27%20width%3D%2734%27%20height%3D%272%27%2F%3E%3Crect%20y%3D%2722%27%20width%3D%274%27%20height%3D%274%27%2F%3E%3Crect%20x%3D%278%27%20y%3D%2723%27%20width%3D%2734%27%20height%3D%272%27%2F%3E%3C%2Fsvg%3E\\\\\\");\\\\n}\\\\n\\\\n.class {\\\\n filter: url('data:image/svg+xml;charset=utf-8,#filter');\\\\n}\\\\n\\\\n.class {\\\\n filter: url('data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%5C%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%5C%22%3E%3Cfilter%20id%3D%5C%22filter%5C%22%3E%3CfeGaussianBlur%20in%3D%5C%22SourceAlpha%5C%22%20stdDeviation%3D%5C%220%5C%22%20%2F%3E%3CfeOffset%20dx%3D%5C%221%5C%22%20dy%3D%5C%222%5C%22%20result%3D%5C%22offsetblur%5C%22%20%2F%3E%3CfeFlood%20flood-color%3D%5C%22rgba(255%2C255%2C255%2C1)%5C%22%20%2F%3E%3CfeComposite%20in2%3D%5C%22offsetblur%5C%22%20operator%3D%5C%22in%5C%22%20%2F%3E%3CfeMerge%3E%3CfeMergeNode%20%2F%3E%3CfeMergeNode%20in%3D%5C%22SourceGraphic%5C%22%20%2F%3E%3C%2FfeMerge%3E%3C%2Ffilter%3E%3C%2Fsvg%3E%23filter');\\\\n}\\\\n\\\\n.highlight {\\\\n filter: url(#highlight);\\\\n}\\\\n\\\\n.highlight {\\\\n filter: url('#line-marker');\\\\n}\\\\n\\\\n@font-face {\\\\n src: url(./font.woff) format('woff'),\\\\n url('./font.woff2') format('woff2'),\\\\n url(\\\\\\"./font.eot\\\\\\") format('eot'),\\\\n url(~package/font.ttf) format('truetype'),\\\\n url(\\\\\\"./font with spaces.eot\\\\\\") format(\\\\\\"embedded-opentype\\\\\\"),\\\\n url('./font.svg#svgFontName') format('svg'),\\\\n url('./font.woff2?foo=bar') format('woff2'),\\\\n url(\\\\\\"./font.eot?#iefix\\\\\\") format('embedded-opentype'),\\\\n url(\\\\\\"./font with spaces.eot?#iefix\\\\\\") format('embedded-opentype');\\\\n}\\\\n\\\\n@media (min-width: 500px) {\\\\n body {\\\\n background: url(\\\\\\"./img.png\\\\\\");\\\\n }\\\\n}\\\\n\\\\na {\\\\n content: \\\\\\"do not use url(path)\\\\\\";\\\\n}\\\\n\\\\nb {\\\\n content: 'do not \\\\\\"use\\\\\\" url(path)';\\\\n}\\\\n\\\\n@keyframes anim {\\\\n background: green url('./img.png') xyz;\\\\n}\\\\n\\\\n.a {\\\\n background-image: -webkit-image-set(url('./img1x.png') 1x, url('./img2x.png') 2x)\\\\n}\\\\n\\\\n.a {\\\\n background-image: image-set(url('./img1x.png') 1x, url('./img2x.png') 2x)\\\\n}\\\\n\\\\n.class {\\\\n background: green url() xyz;\\\\n}\\\\n\\\\n.class {\\\\n background: green url('') xyz;\\\\n}\\\\n\\\\n.class {\\\\n background: green url(\\\\\\"\\\\\\") xyz;\\\\n}\\\\n\\\\n.class {\\\\n background: green url(' ') xyz;\\\\n}\\\\n\\\\n.class {\\\\n background: green url(\\\\n ) xyz;\\\\n}\\\\n\\\\n.class {\\\\n background: green url(https://raw.githubusercontent.com/webpack/media/master/logo/icon.png) xyz;\\\\n}\\\\n\\\\n.class {\\\\n background: green url(//raw.githubusercontent.com/webpack/media/master/logo/icon.png) xyz;\\\\n}\\\\n\\\\n.class {\\\\n background: url(\\\\\\"./img.png?foo\\\\\\");\\\\n}\\\\n\\\\n.class {\\\\n background: url(\\\\\\"./img.png?foo=bar\\\\\\");\\\\n}\\\\n\\\\n.class {\\\\n background: url(\\\\\\"./img.png?foo=bar#hash\\\\\\");\\\\n}\\\\n\\\\n.class {\\\\n background: url(\\\\\\"./img.png?foo=bar#hash\\\\\\");\\\\n}\\\\n\\\\n.class {\\\\n background: url(\\\\\\"./img.png?\\\\\\");\\\\n}\\\\n\\\\n.class {\\\\n background-image: url('./img.png') url(\\\\\\"data:image/svg+xml;charset=utf-8,\\\\\\") url('./img.png');\\\\n}\\\\n\\\\n.class {\\\\n background: ___CSS_LOADER_URL___;\\\\n background: ___CSS_LOADER_URL___INDEX___;\\\\n background: ___CSS_LOADER_URL___99999___;\\\\n background: ___CSS_LOADER_IMPORT___;\\\\n background: ___CSS_LOADER_IMPORT___INDEX___;\\\\n background: ___CSS_LOADER_IMPORT___99999___;\\\\n}\\\\n\\\\n.pure-url {\\\\n background: url('img-simple.png');\\\\n}\\\\n\\\\n.not-resolved {\\\\n background: url('/img-simple.png');\\\\n}\\\\n\\\\n.above-below {\\\\n background: url('../url/img-simple.png');\\\\n}\\\\n\\\\n.tilde {\\\\n background: url('~package/img.png');\\\\n}\\\\n\\\\n.aliases {\\\\n background: url('~aliasesImg/img.png') ;\\\\n}\\\\n\\\\na {\\\\n background: url(./nested/img.png);\\\\n}\\\\n\\\\na {\\\\n background: url(nested/img.png);\\\\n}\\\\n\\\\n@font-face {\\\\n src: url(\\\\\\"//at.alicdn.com/t/font_515771_emcns5054x3whfr.eot\\\\\\");\\\\n}\\\\n\\\\n.class {\\\\n /* Broken */\\\\n background-image: -webkit-image-set();\\\\n background-image: -webkit-image-set('');\\\\n background-image: image-set();\\\\n background-image: image-set('');\\\\n background-image: image-set(\\\\\\"\\\\\\");\\\\n background-image: image-set(\\\\\\"\\\\\\" 1x);\\\\n background-image: image-set(url());\\\\n background-image: image-set(\\\\n url()\\\\n );\\\\n background-image: image-set(URL());\\\\n background-image: image-set(url(''));\\\\n background-image: image-set(url(\\\\\\"\\\\\\"));\\\\n background-image: image-set(url('') 1x);\\\\n background-image: image-set(1x);\\\\n background-image: image-set(\\\\n 1x\\\\n );\\\\n background: image-set(calc(1rem + 1px) 1x);\\\\n\\\\n /* Strings */\\\\n background-image: -webkit-image-set(\\\\\\"./img1x.png\\\\\\" 1x, \\\\\\"./img2x.png\\\\\\" 2x);\\\\n background-image: image-set(\\\\\\"./img1x.png\\\\\\" 1x);\\\\n background-image: image-set(\\\\\\"./img1x.png\\\\\\" 1x, \\\\\\"./img2x.png\\\\\\" 2x);\\\\n background-image: image-set(\\\\\\"./img img.png\\\\\\" 1x, \\\\\\"./img img.png\\\\\\" 2x);\\\\n background-image: image-set(\\\\\\"./img1x.png\\\\\\" 1x, \\\\\\"./img2x.png\\\\\\" 2x),\\\\n image-set(\\\\\\"./img1x.png\\\\\\" 1x, \\\\\\"./img2x.png\\\\\\" 2x);\\\\n background-image: image-set(\\\\n \\\\\\"./img1x.png\\\\\\" 1x,\\\\n \\\\\\"./img2x.png\\\\\\" 2x,\\\\n \\\\\\"./img3x.png\\\\\\" 600dpi\\\\n );\\\\n background-image: image-set(\\\\\\"./img1x.png?foo=bar\\\\\\" 1x);\\\\n background-image: image-set(\\\\\\"./img1x.png#hash\\\\\\" 1x);\\\\n background-image: image-set(\\\\\\"./img1x.png?#iefix\\\\\\" 1x);\\\\n\\\\n /* With \`url\` function */\\\\n background-image: -webkit-image-set(url(\\\\\\"./img1x.png\\\\\\") 1x, url(\\\\\\"./img2x.png\\\\\\") 2x);\\\\n background-image: -webkit-image-set(url(\\\\\\"./img1x.png\\\\\\") 1x);\\\\n background-image: -webkit-image-set(\\\\n url(\\\\\\"./img1x.png\\\\\\") 1x\\\\n );\\\\n background-image: image-set(url(./img1x.png) 1x);\\\\n background-image: image-set(\\\\n url(./img1x.png) 1x\\\\n );\\\\n background-image: image-set(url(\\\\\\"./img1x.png\\\\\\") 1x, url(\\\\\\"./img2x.png\\\\\\") 2x);\\\\n background-image: image-set(\\\\n url(./img1x.png) 1x,\\\\n url(./img2x.png) 2x,\\\\n url(./img3x.png) 600dpi\\\\n );\\\\n background-image: image-set(url(\\\\\\"./img img.png\\\\\\") 1x, url(\\\\\\"./img img.png\\\\\\") 2x);\\\\n\\\\n background-image: image-set(url(\\\\\\"./img1x.png\\\\\\") 1x, \\\\\\"./img2x.png\\\\\\" 2x);\\\\n}\\\\n\\\\n.class {\\\\n /* Not allowed on windows */\\\\n /* background: url(./img\\\\\\\\\\\\\\"img.png); */\\\\n background: url(./img\\\\\\\\'img.png);\\\\n background: url(./img\\\\\\\\'\\\\\\\\'\\\\\\\\'img.png);\\\\n background: url(./img\\\\\\\\(img.png);\\\\n background: url(./img\\\\\\\\)img.png);\\\\n background: url(./img\\\\\\\\ img.png);\\\\n background: url(./img\\\\\\\\'\\\\\\\\(\\\\\\\\)\\\\\\\\ img.png);\\\\n\\\\n background-image: image-set(\\\\n /* Not allowed on windows */\\\\n /* url(./img\\\\\\\\\\\\\\"img.png) 1x, */\\\\n url(./img\\\\\\\\'\\\\\\\\'\\\\\\\\'img.png) 2x,\\\\n url(./img\\\\\\\\'img.png) 3x,\\\\n url(./img\\\\\\\\(img.png) 4x,\\\\n url(./img\\\\\\\\)img.png) 5x,\\\\n url(./img\\\\\\\\ img.png) 6x,\\\\n url(./img\\\\\\\\'\\\\\\\\(\\\\\\\\)\\\\\\\\ img.png) 7x\\\\n );\\\\n}\\\\n\\\\n.class-class-class {\\\\n background: url(\\\\\\"./img'''img.png\\\\\\");\\\\n background: url(\\\\\\"./img'() img.png\\\\\\");\\\\n background: url(\\\\\\"./img'img.png\\\\\\");\\\\n background: url(\\\\\\"./img(img.png\\\\\\");\\\\n background: url(\\\\\\"./img)img.png\\\\\\");\\\\n background: url('./img img.png');\\\\n background: url(\\\\\\"./img img.png\\\\\\");\\\\n}\\\\n\\", \\"\\"]); -" -`; - -exports[`url option false: warnings 1`] = `Array []`; - exports[`url option true: errors 1`] = `Array []`; exports[`url option true: module (evaluated) 1`] = ` @@ -1080,6 +314,11 @@ a { background: url(\\"/webpack/public/path/img img.png\\"); background: url(\\"/webpack/public/path/img img.png\\"); } + +.class.class.class { + background: url(\\"/webpack/public/path/img(img.png\\"); + background: url(\\"/webpack/public/path/img(img.png\\"); +} ", "", ], @@ -1160,7 +399,7 @@ var ___CSS_LOADER_URL_IMPORT_35___ = ___CSS_LOADER_GET_URL_IMPORT___(___CSS_LOAD var ___CSS_LOADER_URL_IMPORT_36___ = ___CSS_LOADER_GET_URL_IMPORT___(___CSS_LOADER_URL_PURE_IMPORT_36___); var ___CSS_LOADER_URL_IMPORT_37___ = ___CSS_LOADER_GET_URL_IMPORT___(___CSS_LOADER_URL_PURE_IMPORT_37___); // Module -exports.push([module.id, \\".class {\\\\n background: url(\\" + ___CSS_LOADER_URL_IMPORT_0___ + \\");\\\\n}\\\\n\\\\n.class {\\\\n background: url(\\" + ___CSS_LOADER_URL_IMPORT_0___ + \\");\\\\n}\\\\n\\\\n.class {\\\\n background: url(\\" + ___CSS_LOADER_URL_IMPORT_0___ + \\");\\\\n}\\\\n\\\\n.class {\\\\n background: url(\\" + ___CSS_LOADER_URL_IMPORT_1___ + \\");\\\\n}\\\\n\\\\n.class {\\\\n background: url(\\\\n \\" + ___CSS_LOADER_URL_IMPORT_0___ + \\"\\\\n );\\\\n}\\\\n\\\\n.class {\\\\n background: green url( \\" + ___CSS_LOADER_URL_IMPORT_0___ + \\" ) xyz;\\\\n}\\\\n\\\\n.class {\\\\n background: green url( \\" + ___CSS_LOADER_URL_IMPORT_0___ + \\" ) xyz;\\\\n}\\\\n\\\\n.class {\\\\n background: green url( \\" + ___CSS_LOADER_URL_IMPORT_0___ + \\" ) xyz;\\\\n}\\\\n\\\\n.class {\\\\n background: green url(\\" + ___CSS_LOADER_URL_IMPORT_2___ + \\") url(\\" + ___CSS_LOADER_URL_IMPORT_3___ + \\") xyz;\\\\n}\\\\n\\\\n.class {\\\\n background: green url( \\" + ___CSS_LOADER_URL_IMPORT_4___ + \\" ) xyz;\\\\n}\\\\n\\\\n.class {\\\\n background: green url( \\" + ___CSS_LOADER_URL_IMPORT_4___ + \\" ) xyz;\\\\n}\\\\n\\\\n.class {\\\\n background: green url(/img.png) xyz;\\\\n}\\\\n\\\\n.class {\\\\n background: green url(data:image/png;base64,AAA) url(http://example.com/image.jpg) url(//example.com/image.png) xyz;\\\\n}\\\\n\\\\n.class {\\\\n background-image: url(\\\\\\"data:image/svg+xml;charset=utf-8,\\\\\\");\\\\n}\\\\n\\\\n.class {\\\\n background-image: url(\\\\\\"data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20viewBox%3D%270%200%2042%2026%27%20fill%3D%27%2523007aff%27%3E%3Crect%20width%3D%274%27%20height%3D%274%27%2F%3E%3Crect%20x%3D%278%27%20y%3D%271%27%20width%3D%2734%27%20height%3D%272%27%2F%3E%3Crect%20y%3D%2711%27%20width%3D%274%27%20height%3D%274%27%2F%3E%3Crect%20x%3D%278%27%20y%3D%2712%27%20width%3D%2734%27%20height%3D%272%27%2F%3E%3Crect%20y%3D%2722%27%20width%3D%274%27%20height%3D%274%27%2F%3E%3Crect%20x%3D%278%27%20y%3D%2723%27%20width%3D%2734%27%20height%3D%272%27%2F%3E%3C%2Fsvg%3E\\\\\\");\\\\n}\\\\n\\\\n.class {\\\\n filter: url('data:image/svg+xml;charset=utf-8,#filter');\\\\n}\\\\n\\\\n.class {\\\\n filter: url('data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%5C%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%5C%22%3E%3Cfilter%20id%3D%5C%22filter%5C%22%3E%3CfeGaussianBlur%20in%3D%5C%22SourceAlpha%5C%22%20stdDeviation%3D%5C%220%5C%22%20%2F%3E%3CfeOffset%20dx%3D%5C%221%5C%22%20dy%3D%5C%222%5C%22%20result%3D%5C%22offsetblur%5C%22%20%2F%3E%3CfeFlood%20flood-color%3D%5C%22rgba(255%2C255%2C255%2C1)%5C%22%20%2F%3E%3CfeComposite%20in2%3D%5C%22offsetblur%5C%22%20operator%3D%5C%22in%5C%22%20%2F%3E%3CfeMerge%3E%3CfeMergeNode%20%2F%3E%3CfeMergeNode%20in%3D%5C%22SourceGraphic%5C%22%20%2F%3E%3C%2FfeMerge%3E%3C%2Ffilter%3E%3C%2Fsvg%3E%23filter');\\\\n}\\\\n\\\\n.highlight {\\\\n filter: url(#highlight);\\\\n}\\\\n\\\\n.highlight {\\\\n filter: url('#line-marker');\\\\n}\\\\n\\\\n@font-face {\\\\n src: url(\\" + ___CSS_LOADER_URL_IMPORT_5___ + \\") format('woff'),\\\\n url(\\" + ___CSS_LOADER_URL_IMPORT_6___ + \\") format('woff2'),\\\\n url(\\" + ___CSS_LOADER_URL_IMPORT_7___ + \\") format('eot'),\\\\n url(\\" + ___CSS_LOADER_URL_IMPORT_8___ + \\") format('truetype'),\\\\n url(\\" + ___CSS_LOADER_URL_IMPORT_9___ + \\") format(\\\\\\"embedded-opentype\\\\\\"),\\\\n url(\\" + ___CSS_LOADER_URL_IMPORT_10___ + \\") format('svg'),\\\\n url(\\" + ___CSS_LOADER_URL_IMPORT_11___ + \\") format('woff2'),\\\\n url(\\" + ___CSS_LOADER_URL_IMPORT_12___ + \\") format('embedded-opentype'),\\\\n url(\\" + ___CSS_LOADER_URL_IMPORT_13___ + \\") format('embedded-opentype');\\\\n}\\\\n\\\\n@media (min-width: 500px) {\\\\n body {\\\\n background: url(\\" + ___CSS_LOADER_URL_IMPORT_0___ + \\");\\\\n }\\\\n}\\\\n\\\\na {\\\\n content: \\\\\\"do not use url(path)\\\\\\";\\\\n}\\\\n\\\\nb {\\\\n content: 'do not \\\\\\"use\\\\\\" url(path)';\\\\n}\\\\n\\\\n@keyframes anim {\\\\n background: green url(\\" + ___CSS_LOADER_URL_IMPORT_0___ + \\") xyz;\\\\n}\\\\n\\\\n.a {\\\\n background-image: -webkit-image-set(url(\\" + ___CSS_LOADER_URL_IMPORT_14___ + \\") 1x, url(\\" + ___CSS_LOADER_URL_IMPORT_15___ + \\") 2x)\\\\n}\\\\n\\\\n.a {\\\\n background-image: image-set(url(\\" + ___CSS_LOADER_URL_IMPORT_14___ + \\") 1x, url(\\" + ___CSS_LOADER_URL_IMPORT_15___ + \\") 2x)\\\\n}\\\\n\\\\n.class {\\\\n background: green url() xyz;\\\\n}\\\\n\\\\n.class {\\\\n background: green url('') xyz;\\\\n}\\\\n\\\\n.class {\\\\n background: green url(\\\\\\"\\\\\\") xyz;\\\\n}\\\\n\\\\n.class {\\\\n background: green url(' ') xyz;\\\\n}\\\\n\\\\n.class {\\\\n background: green url(\\\\n ) xyz;\\\\n}\\\\n\\\\n.class {\\\\n background: green url(https://raw.githubusercontent.com/webpack/media/master/logo/icon.png) xyz;\\\\n}\\\\n\\\\n.class {\\\\n background: green url(//raw.githubusercontent.com/webpack/media/master/logo/icon.png) xyz;\\\\n}\\\\n\\\\n.class {\\\\n background: url(\\" + ___CSS_LOADER_URL_IMPORT_16___ + \\");\\\\n}\\\\n\\\\n.class {\\\\n background: url(\\" + ___CSS_LOADER_URL_IMPORT_17___ + \\");\\\\n}\\\\n\\\\n.class {\\\\n background: url(\\" + ___CSS_LOADER_URL_IMPORT_18___ + \\");\\\\n}\\\\n\\\\n.class {\\\\n background: url(\\" + ___CSS_LOADER_URL_IMPORT_18___ + \\");\\\\n}\\\\n\\\\n.class {\\\\n background: url(\\" + ___CSS_LOADER_URL_IMPORT_19___ + \\");\\\\n}\\\\n\\\\n.class {\\\\n background-image: url(\\" + ___CSS_LOADER_URL_IMPORT_0___ + \\") url(\\\\\\"data:image/svg+xml;charset=utf-8,\\\\\\") url(\\" + ___CSS_LOADER_URL_IMPORT_0___ + \\");\\\\n}\\\\n\\\\n.class {\\\\n background: ___CSS_LOADER_URL___;\\\\n background: ___CSS_LOADER_URL___INDEX___;\\\\n background: ___CSS_LOADER_URL___99999___;\\\\n background: ___CSS_LOADER_IMPORT___;\\\\n background: ___CSS_LOADER_IMPORT___INDEX___;\\\\n background: ___CSS_LOADER_IMPORT___99999___;\\\\n}\\\\n\\\\n.pure-url {\\\\n background: url(\\" + ___CSS_LOADER_URL_IMPORT_20___ + \\");\\\\n}\\\\n\\\\n.not-resolved {\\\\n background: url('/img-simple.png');\\\\n}\\\\n\\\\n.above-below {\\\\n background: url(\\" + ___CSS_LOADER_URL_IMPORT_21___ + \\");\\\\n}\\\\n\\\\n.tilde {\\\\n background: url(\\" + ___CSS_LOADER_URL_IMPORT_2___ + \\");\\\\n}\\\\n\\\\n.aliases {\\\\n background: url(\\" + ___CSS_LOADER_URL_IMPORT_22___ + \\");\\\\n}\\\\n\\\\na {\\\\n background: url(\\" + ___CSS_LOADER_URL_IMPORT_23___ + \\");\\\\n}\\\\n\\\\na {\\\\n background: url(\\" + ___CSS_LOADER_URL_IMPORT_24___ + \\");\\\\n}\\\\n\\\\n@font-face {\\\\n src: url(\\\\\\"//at.alicdn.com/t/font_515771_emcns5054x3whfr.eot\\\\\\");\\\\n}\\\\n\\\\n.class {\\\\n /* Broken */\\\\n background-image: -webkit-image-set();\\\\n background-image: -webkit-image-set('');\\\\n background-image: image-set();\\\\n background-image: image-set('');\\\\n background-image: image-set(\\\\\\"\\\\\\");\\\\n background-image: image-set(\\\\\\"\\\\\\" 1x);\\\\n background-image: image-set(url());\\\\n background-image: image-set(\\\\n url()\\\\n );\\\\n background-image: image-set(URL());\\\\n background-image: image-set(url(''));\\\\n background-image: image-set(url(\\\\\\"\\\\\\"));\\\\n background-image: image-set(url('') 1x);\\\\n background-image: image-set(1x);\\\\n background-image: image-set(\\\\n 1x\\\\n );\\\\n background: image-set(calc(1rem + 1px) 1x);\\\\n\\\\n /* Strings */\\\\n background-image: -webkit-image-set(\\" + ___CSS_LOADER_URL_IMPORT_25___ + \\" 1x, \\" + ___CSS_LOADER_URL_IMPORT_26___ + \\" 2x);\\\\n background-image: image-set(\\" + ___CSS_LOADER_URL_IMPORT_25___ + \\" 1x);\\\\n background-image: image-set(\\" + ___CSS_LOADER_URL_IMPORT_25___ + \\" 1x, \\" + ___CSS_LOADER_URL_IMPORT_26___ + \\" 2x);\\\\n background-image: image-set(\\" + ___CSS_LOADER_URL_IMPORT_27___ + \\" 1x, \\" + ___CSS_LOADER_URL_IMPORT_27___ + \\" 2x);\\\\n background-image: image-set(\\" + ___CSS_LOADER_URL_IMPORT_25___ + \\" 1x, \\" + ___CSS_LOADER_URL_IMPORT_26___ + \\" 2x),\\\\n image-set(\\" + ___CSS_LOADER_URL_IMPORT_25___ + \\" 1x, \\" + ___CSS_LOADER_URL_IMPORT_26___ + \\" 2x);\\\\n background-image: image-set(\\\\n \\" + ___CSS_LOADER_URL_IMPORT_25___ + \\" 1x,\\\\n \\" + ___CSS_LOADER_URL_IMPORT_26___ + \\" 2x,\\\\n \\" + ___CSS_LOADER_URL_IMPORT_28___ + \\" 600dpi\\\\n );\\\\n background-image: image-set(\\" + ___CSS_LOADER_URL_IMPORT_29___ + \\" 1x);\\\\n background-image: image-set(\\" + ___CSS_LOADER_URL_IMPORT_30___ + \\" 1x);\\\\n background-image: image-set(\\" + ___CSS_LOADER_URL_IMPORT_31___ + \\" 1x);\\\\n\\\\n /* With \`url\` function */\\\\n background-image: -webkit-image-set(url(\\" + ___CSS_LOADER_URL_IMPORT_14___ + \\") 1x, url(\\" + ___CSS_LOADER_URL_IMPORT_15___ + \\") 2x);\\\\n background-image: -webkit-image-set(url(\\" + ___CSS_LOADER_URL_IMPORT_14___ + \\") 1x);\\\\n background-image: -webkit-image-set(\\\\n url(\\" + ___CSS_LOADER_URL_IMPORT_14___ + \\") 1x\\\\n );\\\\n background-image: image-set(url(\\" + ___CSS_LOADER_URL_IMPORT_14___ + \\") 1x);\\\\n background-image: image-set(\\\\n url(\\" + ___CSS_LOADER_URL_IMPORT_14___ + \\") 1x\\\\n );\\\\n background-image: image-set(url(\\" + ___CSS_LOADER_URL_IMPORT_14___ + \\") 1x, url(\\" + ___CSS_LOADER_URL_IMPORT_15___ + \\") 2x);\\\\n background-image: image-set(\\\\n url(\\" + ___CSS_LOADER_URL_IMPORT_14___ + \\") 1x,\\\\n url(\\" + ___CSS_LOADER_URL_IMPORT_15___ + \\") 2x,\\\\n url(\\" + ___CSS_LOADER_URL_IMPORT_32___ + \\") 600dpi\\\\n );\\\\n background-image: image-set(url(\\" + ___CSS_LOADER_URL_IMPORT_4___ + \\") 1x, url(\\" + ___CSS_LOADER_URL_IMPORT_4___ + \\") 2x);\\\\n\\\\n background-image: image-set(url(\\" + ___CSS_LOADER_URL_IMPORT_14___ + \\") 1x, \\" + ___CSS_LOADER_URL_IMPORT_26___ + \\" 2x);\\\\n}\\\\n\\\\n.class {\\\\n /* Not allowed on windows */\\\\n /* background: url(./img\\\\\\\\\\\\\\"img.png); */\\\\n background: url(\\" + ___CSS_LOADER_URL_IMPORT_33___ + \\");\\\\n background: url(\\" + ___CSS_LOADER_URL_IMPORT_34___ + \\");\\\\n background: url(\\" + ___CSS_LOADER_URL_IMPORT_35___ + \\");\\\\n background: url(\\" + ___CSS_LOADER_URL_IMPORT_36___ + \\");\\\\n background: url(\\" + ___CSS_LOADER_URL_IMPORT_4___ + \\");\\\\n background: url(\\" + ___CSS_LOADER_URL_IMPORT_37___ + \\");\\\\n\\\\n background-image: image-set(\\\\n \\\\n \\\\n url(\\" + ___CSS_LOADER_URL_IMPORT_34___ + \\") 2x,\\\\n url(\\" + ___CSS_LOADER_URL_IMPORT_33___ + \\") 3x,\\\\n url(\\" + ___CSS_LOADER_URL_IMPORT_35___ + \\") 4x,\\\\n url(\\" + ___CSS_LOADER_URL_IMPORT_36___ + \\") 5x,\\\\n url(\\" + ___CSS_LOADER_URL_IMPORT_4___ + \\") 6x,\\\\n url(\\" + ___CSS_LOADER_URL_IMPORT_37___ + \\") 7x\\\\n );\\\\n}\\\\n\\\\n.class-class-class {\\\\n background: url(\\" + ___CSS_LOADER_URL_IMPORT_34___ + \\");\\\\n background: url(\\" + ___CSS_LOADER_URL_IMPORT_37___ + \\");\\\\n background: url(\\" + ___CSS_LOADER_URL_IMPORT_33___ + \\");\\\\n background: url(\\" + ___CSS_LOADER_URL_IMPORT_35___ + \\");\\\\n background: url(\\" + ___CSS_LOADER_URL_IMPORT_36___ + \\");\\\\n background: url(\\" + ___CSS_LOADER_URL_IMPORT_4___ + \\");\\\\n background: url(\\" + ___CSS_LOADER_URL_IMPORT_4___ + \\");\\\\n}\\\\n\\", \\"\\"]); +exports.push([module.id, \\".class {\\\\n background: url(\\" + ___CSS_LOADER_URL_IMPORT_0___ + \\");\\\\n}\\\\n\\\\n.class {\\\\n background: url(\\" + ___CSS_LOADER_URL_IMPORT_0___ + \\");\\\\n}\\\\n\\\\n.class {\\\\n background: url(\\" + ___CSS_LOADER_URL_IMPORT_0___ + \\");\\\\n}\\\\n\\\\n.class {\\\\n background: url(\\" + ___CSS_LOADER_URL_IMPORT_1___ + \\");\\\\n}\\\\n\\\\n.class {\\\\n background: url(\\\\n \\" + ___CSS_LOADER_URL_IMPORT_0___ + \\"\\\\n );\\\\n}\\\\n\\\\n.class {\\\\n background: green url( \\" + ___CSS_LOADER_URL_IMPORT_0___ + \\" ) xyz;\\\\n}\\\\n\\\\n.class {\\\\n background: green url( \\" + ___CSS_LOADER_URL_IMPORT_0___ + \\" ) xyz;\\\\n}\\\\n\\\\n.class {\\\\n background: green url( \\" + ___CSS_LOADER_URL_IMPORT_0___ + \\" ) xyz;\\\\n}\\\\n\\\\n.class {\\\\n background: green url(\\" + ___CSS_LOADER_URL_IMPORT_2___ + \\") url(\\" + ___CSS_LOADER_URL_IMPORT_3___ + \\") xyz;\\\\n}\\\\n\\\\n.class {\\\\n background: green url( \\" + ___CSS_LOADER_URL_IMPORT_4___ + \\" ) xyz;\\\\n}\\\\n\\\\n.class {\\\\n background: green url( \\" + ___CSS_LOADER_URL_IMPORT_4___ + \\" ) xyz;\\\\n}\\\\n\\\\n.class {\\\\n background: green url(/img.png) xyz;\\\\n}\\\\n\\\\n.class {\\\\n background: green url(data:image/png;base64,AAA) url(http://example.com/image.jpg) url(//example.com/image.png) xyz;\\\\n}\\\\n\\\\n.class {\\\\n background-image: url(\\\\\\"data:image/svg+xml;charset=utf-8,\\\\\\");\\\\n}\\\\n\\\\n.class {\\\\n background-image: url(\\\\\\"data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20viewBox%3D%270%200%2042%2026%27%20fill%3D%27%2523007aff%27%3E%3Crect%20width%3D%274%27%20height%3D%274%27%2F%3E%3Crect%20x%3D%278%27%20y%3D%271%27%20width%3D%2734%27%20height%3D%272%27%2F%3E%3Crect%20y%3D%2711%27%20width%3D%274%27%20height%3D%274%27%2F%3E%3Crect%20x%3D%278%27%20y%3D%2712%27%20width%3D%2734%27%20height%3D%272%27%2F%3E%3Crect%20y%3D%2722%27%20width%3D%274%27%20height%3D%274%27%2F%3E%3Crect%20x%3D%278%27%20y%3D%2723%27%20width%3D%2734%27%20height%3D%272%27%2F%3E%3C%2Fsvg%3E\\\\\\");\\\\n}\\\\n\\\\n.class {\\\\n filter: url('data:image/svg+xml;charset=utf-8,#filter');\\\\n}\\\\n\\\\n.class {\\\\n filter: url('data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%5C%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%5C%22%3E%3Cfilter%20id%3D%5C%22filter%5C%22%3E%3CfeGaussianBlur%20in%3D%5C%22SourceAlpha%5C%22%20stdDeviation%3D%5C%220%5C%22%20%2F%3E%3CfeOffset%20dx%3D%5C%221%5C%22%20dy%3D%5C%222%5C%22%20result%3D%5C%22offsetblur%5C%22%20%2F%3E%3CfeFlood%20flood-color%3D%5C%22rgba(255%2C255%2C255%2C1)%5C%22%20%2F%3E%3CfeComposite%20in2%3D%5C%22offsetblur%5C%22%20operator%3D%5C%22in%5C%22%20%2F%3E%3CfeMerge%3E%3CfeMergeNode%20%2F%3E%3CfeMergeNode%20in%3D%5C%22SourceGraphic%5C%22%20%2F%3E%3C%2FfeMerge%3E%3C%2Ffilter%3E%3C%2Fsvg%3E%23filter');\\\\n}\\\\n\\\\n.highlight {\\\\n filter: url(#highlight);\\\\n}\\\\n\\\\n.highlight {\\\\n filter: url('#line-marker');\\\\n}\\\\n\\\\n@font-face {\\\\n src: url(\\" + ___CSS_LOADER_URL_IMPORT_5___ + \\") format('woff'),\\\\n url(\\" + ___CSS_LOADER_URL_IMPORT_6___ + \\") format('woff2'),\\\\n url(\\" + ___CSS_LOADER_URL_IMPORT_7___ + \\") format('eot'),\\\\n url(\\" + ___CSS_LOADER_URL_IMPORT_8___ + \\") format('truetype'),\\\\n url(\\" + ___CSS_LOADER_URL_IMPORT_9___ + \\") format(\\\\\\"embedded-opentype\\\\\\"),\\\\n url(\\" + ___CSS_LOADER_URL_IMPORT_10___ + \\") format('svg'),\\\\n url(\\" + ___CSS_LOADER_URL_IMPORT_11___ + \\") format('woff2'),\\\\n url(\\" + ___CSS_LOADER_URL_IMPORT_12___ + \\") format('embedded-opentype'),\\\\n url(\\" + ___CSS_LOADER_URL_IMPORT_13___ + \\") format('embedded-opentype');\\\\n}\\\\n\\\\n@media (min-width: 500px) {\\\\n body {\\\\n background: url(\\" + ___CSS_LOADER_URL_IMPORT_0___ + \\");\\\\n }\\\\n}\\\\n\\\\na {\\\\n content: \\\\\\"do not use url(path)\\\\\\";\\\\n}\\\\n\\\\nb {\\\\n content: 'do not \\\\\\"use\\\\\\" url(path)';\\\\n}\\\\n\\\\n@keyframes anim {\\\\n background: green url(\\" + ___CSS_LOADER_URL_IMPORT_0___ + \\") xyz;\\\\n}\\\\n\\\\n.a {\\\\n background-image: -webkit-image-set(url(\\" + ___CSS_LOADER_URL_IMPORT_14___ + \\") 1x, url(\\" + ___CSS_LOADER_URL_IMPORT_15___ + \\") 2x)\\\\n}\\\\n\\\\n.a {\\\\n background-image: image-set(url(\\" + ___CSS_LOADER_URL_IMPORT_14___ + \\") 1x, url(\\" + ___CSS_LOADER_URL_IMPORT_15___ + \\") 2x)\\\\n}\\\\n\\\\n.class {\\\\n background: green url() xyz;\\\\n}\\\\n\\\\n.class {\\\\n background: green url('') xyz;\\\\n}\\\\n\\\\n.class {\\\\n background: green url(\\\\\\"\\\\\\") xyz;\\\\n}\\\\n\\\\n.class {\\\\n background: green url(' ') xyz;\\\\n}\\\\n\\\\n.class {\\\\n background: green url(\\\\n ) xyz;\\\\n}\\\\n\\\\n.class {\\\\n background: green url(https://raw.githubusercontent.com/webpack/media/master/logo/icon.png) xyz;\\\\n}\\\\n\\\\n.class {\\\\n background: green url(//raw.githubusercontent.com/webpack/media/master/logo/icon.png) xyz;\\\\n}\\\\n\\\\n.class {\\\\n background: url(\\" + ___CSS_LOADER_URL_IMPORT_16___ + \\");\\\\n}\\\\n\\\\n.class {\\\\n background: url(\\" + ___CSS_LOADER_URL_IMPORT_17___ + \\");\\\\n}\\\\n\\\\n.class {\\\\n background: url(\\" + ___CSS_LOADER_URL_IMPORT_18___ + \\");\\\\n}\\\\n\\\\n.class {\\\\n background: url(\\" + ___CSS_LOADER_URL_IMPORT_18___ + \\");\\\\n}\\\\n\\\\n.class {\\\\n background: url(\\" + ___CSS_LOADER_URL_IMPORT_19___ + \\");\\\\n}\\\\n\\\\n.class {\\\\n background-image: url(\\" + ___CSS_LOADER_URL_IMPORT_0___ + \\") url(\\\\\\"data:image/svg+xml;charset=utf-8,\\\\\\") url(\\" + ___CSS_LOADER_URL_IMPORT_0___ + \\");\\\\n}\\\\n\\\\n.class {\\\\n background: ___CSS_LOADER_URL___;\\\\n background: ___CSS_LOADER_URL___INDEX___;\\\\n background: ___CSS_LOADER_URL___99999___;\\\\n background: ___CSS_LOADER_IMPORT___;\\\\n background: ___CSS_LOADER_IMPORT___INDEX___;\\\\n background: ___CSS_LOADER_IMPORT___99999___;\\\\n}\\\\n\\\\n.pure-url {\\\\n background: url(\\" + ___CSS_LOADER_URL_IMPORT_20___ + \\");\\\\n}\\\\n\\\\n.not-resolved {\\\\n background: url('/img-simple.png');\\\\n}\\\\n\\\\n.above-below {\\\\n background: url(\\" + ___CSS_LOADER_URL_IMPORT_21___ + \\");\\\\n}\\\\n\\\\n.tilde {\\\\n background: url(\\" + ___CSS_LOADER_URL_IMPORT_2___ + \\");\\\\n}\\\\n\\\\n.aliases {\\\\n background: url(\\" + ___CSS_LOADER_URL_IMPORT_22___ + \\");\\\\n}\\\\n\\\\na {\\\\n background: url(\\" + ___CSS_LOADER_URL_IMPORT_23___ + \\");\\\\n}\\\\n\\\\na {\\\\n background: url(\\" + ___CSS_LOADER_URL_IMPORT_24___ + \\");\\\\n}\\\\n\\\\n@font-face {\\\\n src: url(\\\\\\"//at.alicdn.com/t/font_515771_emcns5054x3whfr.eot\\\\\\");\\\\n}\\\\n\\\\n.class {\\\\n /* Broken */\\\\n background-image: -webkit-image-set();\\\\n background-image: -webkit-image-set('');\\\\n background-image: image-set();\\\\n background-image: image-set('');\\\\n background-image: image-set(\\\\\\"\\\\\\");\\\\n background-image: image-set(\\\\\\"\\\\\\" 1x);\\\\n background-image: image-set(url());\\\\n background-image: image-set(\\\\n url()\\\\n );\\\\n background-image: image-set(URL());\\\\n background-image: image-set(url(''));\\\\n background-image: image-set(url(\\\\\\"\\\\\\"));\\\\n background-image: image-set(url('') 1x);\\\\n background-image: image-set(1x);\\\\n background-image: image-set(\\\\n 1x\\\\n );\\\\n background: image-set(calc(1rem + 1px) 1x);\\\\n\\\\n /* Strings */\\\\n background-image: -webkit-image-set(\\" + ___CSS_LOADER_URL_IMPORT_25___ + \\" 1x, \\" + ___CSS_LOADER_URL_IMPORT_26___ + \\" 2x);\\\\n background-image: image-set(\\" + ___CSS_LOADER_URL_IMPORT_25___ + \\" 1x);\\\\n background-image: image-set(\\" + ___CSS_LOADER_URL_IMPORT_25___ + \\" 1x, \\" + ___CSS_LOADER_URL_IMPORT_26___ + \\" 2x);\\\\n background-image: image-set(\\" + ___CSS_LOADER_URL_IMPORT_27___ + \\" 1x, \\" + ___CSS_LOADER_URL_IMPORT_27___ + \\" 2x);\\\\n background-image: image-set(\\" + ___CSS_LOADER_URL_IMPORT_25___ + \\" 1x, \\" + ___CSS_LOADER_URL_IMPORT_26___ + \\" 2x),\\\\n image-set(\\" + ___CSS_LOADER_URL_IMPORT_25___ + \\" 1x, \\" + ___CSS_LOADER_URL_IMPORT_26___ + \\" 2x);\\\\n background-image: image-set(\\\\n \\" + ___CSS_LOADER_URL_IMPORT_25___ + \\" 1x,\\\\n \\" + ___CSS_LOADER_URL_IMPORT_26___ + \\" 2x,\\\\n \\" + ___CSS_LOADER_URL_IMPORT_28___ + \\" 600dpi\\\\n );\\\\n background-image: image-set(\\" + ___CSS_LOADER_URL_IMPORT_29___ + \\" 1x);\\\\n background-image: image-set(\\" + ___CSS_LOADER_URL_IMPORT_30___ + \\" 1x);\\\\n background-image: image-set(\\" + ___CSS_LOADER_URL_IMPORT_31___ + \\" 1x);\\\\n\\\\n /* With \`url\` function */\\\\n background-image: -webkit-image-set(url(\\" + ___CSS_LOADER_URL_IMPORT_14___ + \\") 1x, url(\\" + ___CSS_LOADER_URL_IMPORT_15___ + \\") 2x);\\\\n background-image: -webkit-image-set(url(\\" + ___CSS_LOADER_URL_IMPORT_14___ + \\") 1x);\\\\n background-image: -webkit-image-set(\\\\n url(\\" + ___CSS_LOADER_URL_IMPORT_14___ + \\") 1x\\\\n );\\\\n background-image: image-set(url(\\" + ___CSS_LOADER_URL_IMPORT_14___ + \\") 1x);\\\\n background-image: image-set(\\\\n url(\\" + ___CSS_LOADER_URL_IMPORT_14___ + \\") 1x\\\\n );\\\\n background-image: image-set(url(\\" + ___CSS_LOADER_URL_IMPORT_14___ + \\") 1x, url(\\" + ___CSS_LOADER_URL_IMPORT_15___ + \\") 2x);\\\\n background-image: image-set(\\\\n url(\\" + ___CSS_LOADER_URL_IMPORT_14___ + \\") 1x,\\\\n url(\\" + ___CSS_LOADER_URL_IMPORT_15___ + \\") 2x,\\\\n url(\\" + ___CSS_LOADER_URL_IMPORT_32___ + \\") 600dpi\\\\n );\\\\n background-image: image-set(url(\\" + ___CSS_LOADER_URL_IMPORT_4___ + \\") 1x, url(\\" + ___CSS_LOADER_URL_IMPORT_4___ + \\") 2x);\\\\n\\\\n background-image: image-set(url(\\" + ___CSS_LOADER_URL_IMPORT_14___ + \\") 1x, \\" + ___CSS_LOADER_URL_IMPORT_26___ + \\" 2x);\\\\n}\\\\n\\\\n.class {\\\\n /* Not allowed on windows */\\\\n /* background: url(./img\\\\\\\\\\\\\\"img.png); */\\\\n background: url(\\" + ___CSS_LOADER_URL_IMPORT_33___ + \\");\\\\n background: url(\\" + ___CSS_LOADER_URL_IMPORT_34___ + \\");\\\\n background: url(\\" + ___CSS_LOADER_URL_IMPORT_35___ + \\");\\\\n background: url(\\" + ___CSS_LOADER_URL_IMPORT_36___ + \\");\\\\n background: url(\\" + ___CSS_LOADER_URL_IMPORT_4___ + \\");\\\\n background: url(\\" + ___CSS_LOADER_URL_IMPORT_37___ + \\");\\\\n\\\\n background-image: image-set(\\\\n \\\\n \\\\n url(\\" + ___CSS_LOADER_URL_IMPORT_34___ + \\") 2x,\\\\n url(\\" + ___CSS_LOADER_URL_IMPORT_33___ + \\") 3x,\\\\n url(\\" + ___CSS_LOADER_URL_IMPORT_35___ + \\") 4x,\\\\n url(\\" + ___CSS_LOADER_URL_IMPORT_36___ + \\") 5x,\\\\n url(\\" + ___CSS_LOADER_URL_IMPORT_4___ + \\") 6x,\\\\n url(\\" + ___CSS_LOADER_URL_IMPORT_37___ + \\") 7x\\\\n );\\\\n}\\\\n\\\\n.class-class-class {\\\\n background: url(\\" + ___CSS_LOADER_URL_IMPORT_34___ + \\");\\\\n background: url(\\" + ___CSS_LOADER_URL_IMPORT_37___ + \\");\\\\n background: url(\\" + ___CSS_LOADER_URL_IMPORT_33___ + \\");\\\\n background: url(\\" + ___CSS_LOADER_URL_IMPORT_35___ + \\");\\\\n background: url(\\" + ___CSS_LOADER_URL_IMPORT_36___ + \\");\\\\n background: url(\\" + ___CSS_LOADER_URL_IMPORT_4___ + \\");\\\\n background: url(\\" + ___CSS_LOADER_URL_IMPORT_4___ + \\");\\\\n}\\\\n\\\\n.class.class.class {\\\\n background: url(\\" + ___CSS_LOADER_URL_IMPORT_35___ + \\");\\\\n background: url(\\" + ___CSS_LOADER_URL_IMPORT_35___ + \\");\\\\n}\\\\n\\", \\"\\"]); " `; diff --git a/test/fixtures/url/url.css b/test/fixtures/url/url.css index bf7ca3b6..75e2cbd7 100644 --- a/test/fixtures/url/url.css +++ b/test/fixtures/url/url.css @@ -300,3 +300,13 @@ a { background: url('./img img.png'); background: url("./img img.png"); } + +.class.class.class { + background: url('./img\ +(img.png'); + background: url('./img\ +\ +\ +\ +(img.png'); +} diff --git a/test/url-option.test.js b/test/url-option.test.js index d716d182..13e4b246 100644 --- a/test/url-option.test.js +++ b/test/url-option.test.js @@ -17,7 +17,7 @@ describe('url option', () => { expect(normalizeErrors(stats.compilation.errors)).toMatchSnapshot('errors'); }); - it('false', async () => { + /* it('false', async () => { const config = { loader: { options: { url: false } } }; const testId = './url/url.css'; const stats = await webpack(testId, config); @@ -62,5 +62,5 @@ describe('url option', () => { 'warnings' ); expect(normalizeErrors(stats.compilation.errors)).toMatchSnapshot('errors'); - }); + });*/ });