/
githubmirror
/
webpack
Обзор
Документация
Войти
/
githubmirror
/
webpack
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
test/configCases/css/minimize-urls/style.css
72 строки
4 KB
Alexander Akait
feat(css): join adjacent rules and fold more value spellings (#21648)
10 авг 2026, 08:55
Не верифицирован
10 авг 2026, 08:55
3197f80
Код
Авторство
О чём код?
/* Ported from cssnano's `postcss-normalize-url` suite. webpack only normalizes the *quoting* of a `url()` — the URL itself is never rewritten, because it is passed through to a server that may read it verbatim — so the cases that resolve `..`, drop default ports or strip `./` are here as passthroughs. The upstream fixtures use relative URLs (`cat.jpg`); those are real asset dependencies in a webpack build, so each is rewritten to an absolute or `data:` URL that the CSS parser leaves alone. The unlabelled first entry in the snapshot is the `@import` below: webpack hoists it above everything, its label included. It is here because an at-rule prelude's `url()` unquotes just like a declaration's. */ @import url('http://website.test/foo.css'); /*! normalize-url: should strip double quotes */ .t01 { background: url("http://website.test/cat.jpg") } /*! normalize-url: should strip single quotes */ .t02 { background: url('http://website.test/cat.jpg') } /*! normalize-url: should strip double quotes uppercase URL */ .t03 { background: URL("http://website.test/cat.jpg") } /*! normalize-url: should not escape more than one special character */ .t04 { background: url("http://website.test/assets_(test).png") } /*! normalize-url: should remove the default port */ .t05 { background: url(http://website.test:80/image.png) } /*! normalize-url: should not remove the fragment */ .t06 { background: url(http://website.test/test.svg#icon) } /*! normalize-url: should normalize directory traversal */ .t07 { background: url(http://website.test/assets/css/../font/t.eot) } /*! normalize-url: should preserve trailing slashes */ .t08 { background: url("https://localhost:4321/api/woff2/inter.woff2/") } /*! normalize-url: should normalize urls with special characters */ .t09 { background: url("http://website.test/test/../(images)/1.png") } /*! normalize-url: should minimise whitespace inside the url function */ .t10 { background: url( http://website.test/test.png ) } /*! normalize-url: should minimise whitespace inside the url function (2) */ .t11 { background: url( ) } /*! normalize-url: should minimise whitespace inside the url string */ .t12 { background: url(" http://website.test/test.png ") } /*! normalize-url: should minimise whitespace inside the url string (2) */ .t13 { background: url(" ") } /* Cases beyond the upstream suite, covering what webpack's own printer decides. */ /*! webpack: an empty url() */ .t14 { background: url("") } /*! webpack: a protocol-relative url */ .t15 { background: url('//cdn.website.test/cat.jpg') } /*! webpack: a data: URI keeps a quote it needs */ .t16 { background: url("data:image/svg+xml,%3Csvg width='1'%3E%3C/svg%3E") } /*! webpack: a data: URI that needs no quote */ .t17 { background: url("data:image/svg+xml,%3Csvg%3E%3C/svg%3E") } /*! webpack: a same-document fragment reference */ .t18 { clip-path: url("#myClip") } /*! webpack: a url holding a quote is wrapped in the other quote */ .t19 { background: url("http://website.test/foo\"bar.jpg") } /*! webpack: src: url() in @font-face */ @font-face { src: url("http://website.test/slab.ttf") format('truetype') } /*! webpack: a custom property's url() is opaque */ .t20 { --bg: url( "http://website.test/cat.jpg" ) } /*! webpack: a data: URI's payload is decoded, its escapes being content the URL parser reads back — all but the bytes a url-token cannot carry */ .t22 { background: url("data:image/svg+xml,%3csvg%20fill=%27red%27%3e%3c/svg%3e") } /*! webpack: ...including base64 padding */ .t23 { background: url("data:image/png;base64,AAA%3D") } /*! declined: the data: URI's own metadata is not payload — outside it an escape is structure, and there webpack's own url normalization has already decoded it */ .t25 { background: url("data:image/svg%2Bxml,x") } /*! declined: `#` would start the fragment and `%` the next escape */ .t26 { background: url("data:text/plain,a%23b%25c") } /*! webpack: a url() whose string the tokenizer never closed is passed through */ .t21 { background: url(" ) }