Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CSS url with relative paths being rewritten incorrectly #372

Open
kevinnivek opened this issue May 20, 2021 · 3 comments
Open

CSS url with relative paths being rewritten incorrectly #372

kevinnivek opened this issue May 20, 2021 · 3 comments

Comments

@kevinnivek
Copy link

I notice when CSS is minified , url references with relative paths (with double quotes) are being rewritten incorrectly :

before :

url("fonts/212c8ce9-e668-4bbf-ab50-783ebeaa2d8a.woff2")

after :

url(../wp-content/themes/theme/fonts/212c8ce9-e668-4bbf-ab50-783ebeaa2d8a.woff2)

This breaks the loading of most of my fonts and things of that nature.

@scorninpc
Copy link

No fix for that?

Before:

url(../webfonts/fa-brands-400.woff2)

After:

url(../../../../public_html/modules/painel/fonts/font-awesome/webfonts/fa-brands-400.woff2)

@short-pixel-optimizer
Copy link

short-pixel-optimizer commented May 15, 2022

AFAIK Minify doesn't update the paths inside the CSS. It could be some other feature or plugin. But could you please provide a test case? Should look like this:

$tests[] = array(
            '<<ACTUAL UNMINIFIED CSS>>',
            '<<EXPECTED MINIFIED CSS>>',
        );

Please check tests/css/CSSTest.php for examples.

@matsumoto-magicword
Copy link

I had the same problem.
I commented out the two lines 339-340 in src/CSS.php and the symptoms stopped occurring.

            $converter = $this->getPathConverter($source, $path ? : $source);
            $css = $this->move($converter, $css);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants