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

[6.0.6] CSS URL Rewriting - Ignores absolute paths #2743

Closed
pmochine opened this issue Jan 5, 2021 · 2 comments
Closed

[6.0.6] CSS URL Rewriting - Ignores absolute paths #2743

pmochine opened this issue Jan 5, 2021 · 2 comments
Assignees

Comments

@pmochine
Copy link

pmochine commented Jan 5, 2021

  • Laravel Mix Version: 6.0.6

Description:

It says Absolute paths for url()s will always be excluded from url-rewriting. However, this does not work for me.

For example in _somefile.scss

.munich{
	background: url(/images/pages/welcome/destination/munich.jpg) no-repeat;
  }

Copies munich.jpg and moves it to public/images/munich.jpg

I know I could use processCssUrls, but I shouldn't because these paths are absolute.

The same happens for fonts and svgs etc.

For example in _fonts.scss

@font-face {
    font-family: 'Saira Extra Condensed';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('/fonts/static/saira-extra-condensed-v5-latin-regular.eot'); /* IE9 Compat Modes */
    src: local('Saira ExtraCondensed Regular'), local('SairaExtraCondensed-Regular'),
         url('/fonts/static/saira-extra-condensed-v5-latin-regular.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
         url('/fonts/static/saira-extra-condensed-v5-latin-regular.woff2') format('woff2'), /* Super Modern Browsers */
         url('/fonts/static/saira-extra-condensed-v5-latin-regular.woff') format('woff'), /* Modern Browsers */
         url('/fonts/static/saira-extra-condensed-v5-latin-regular.ttf') format('truetype'), /* Safari, Android, iOS */
         url('/fonts/static/saira-extra-condensed-v5-latin-regular.svg#SairaExtraCondensed') format('svg'); /* Legacy iOS */
  }

It copies and moves all my fonts to public/fonts/*.*

Edit:
Not sure if it relates to this issue (#2678)

@JeffreyWay JeffreyWay self-assigned this Jan 6, 2021
@JeffreyWay
Copy link
Collaborator

It seems like css-loader changed how they handle absolute paths in a recent update. I've added a filter to return the old behavior.

@antonioreyna
Copy link

is it possible to ignore the url rewrite with the absolute path but keep the versioning at the end? like in url(/images/thing.png?d41d8cd98f00b204e9800998ecf8427e);

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