Anidetrix / rollup-plugin-styles

🎨 Universal Rollup plugin for styles: PostCSS, Sass, Less, Stylus and more.
https://anidetrix.github.io/rollup-plugin-styles
MIT License
243 stars 43 forks source link

postcss issue. not resolving `url` in `src` mixed with `local` attribute #126

Closed argesoft closed 3 years ago

argesoft commented 4 years ago

As I mentioned here there is an issue in processing compiled css. When there is a code with a line like below, postcss does not process it

@font-face {
    font-family: 'PT Sans';
    font-style: normal;
    font-weight: 400;
--->>   src: local('PT Sans'), local('PTSans-Regular'),  url('fonts/PTS-webfont.woff') format('woff');
}

When there is a src attribute mixed with local, then url is not processed at all. Even url->resolve option does not see it.

Originally posted by @argesoft in https://github.com/Anidetrix/rollup-plugin-styles/issues/125#issuecomment-653124822

argesoft commented 4 years ago

As far as I can see, the issue is related to url resolver. source lines 7-8 After replacing /^(?:url|(?:-webkit-)?image-set)\(/i with /^(?:[a-z]{3,}|(?:-webkit-)?image-set)\(/i it works as expected Is there a better solution?

Anidetrix commented 4 years ago

Hi again @argesoft,

Hmm, well this is peculiar. Will investigate this and let you know.

olemartinorg commented 3 years ago

This had me stumped for too long. Fixing the regex by removing the ^ (to let it look past just the start) also works for me. It's pretty obvious (as in the example) that the value does not always start with url( when it contains a url(. Hoping for a quick fix for this!

github-actions[bot] commented 3 years ago

:tada: This issue has been resolved in version 3.12.0 :tada:

The release is available on:

Your semantic-release bot :package::rocket: