Skip to content

Conversation

@MaxSem
Copy link
Contributor

@MaxSem MaxSem commented Feb 19, 2020

Fixes #27

@Krinkle
Copy link
Member

Krinkle commented Mar 19, 2020

LGTM, but would recommend to have a runtime option for this. Less_Parser has an array of default options where this could fit well. Something like 'import_remote_url' => false or some such.

@jedi-pl
Copy link

jedi-pl commented Aug 31, 2020

This PR should be merged as it saves the day

@barryvdh
Copy link
Contributor

barryvdh commented Nov 4, 2020

Note that Magento suggest using protocol-relative URLs: https://devdocs.magento.com/guides/v2.4/frontend-dev-guide/css-topics/css-preprocess.html
@import url('//fonts.googleapis.com/css?family=Titillium+Web:400,300,200,600.css');

So @import url("//fonts.googleapis.com/icon?family=Material+Icons"); would still fail with this PR, right?

@barryvdh
Copy link
Contributor

barryvdh commented Nov 4, 2020

FYI, this also fails with the new Fonts API: https://developers.google.com/fonts/docs/css2

@jdforrester Could you please consider this PR? It's breaking for Magento2 also.

Copy link
Member

@Krinkle Krinkle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be behind an option to allow it to be disabled as defense in-depth (despite overall trust domain not mattering for this library given we only support trusted input only). Overall, it is welcome however.

@mrtuvn
Copy link

mrtuvn commented Jun 10, 2021

@MaxSem can you update change for resolve conflict file

Krinkle pushed a commit that referenced this pull request Aug 10, 2021
The regex that was meant to handle this already accounted for a lot
of edge cases, such as `/css` endpoints without `.css`, and query
parameters like `/css?foo` or `/css;foo`, all to carefully avoid
matching things like `foocss.less` or `foo.css.bar.less`.

However can still be any number of CSS resources served from URLs
that don't match that pattern.

Instead of trying to match the path segment, just match the start of
the URL, which should take care of any edge cases, given that we don't
allow importing remote Less code for compilation anyway.

Fixes #27.
Closes #28.
Closes #68.
@Krinkle Krinkle closed this in 168cb46 Aug 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Compiler doesn't import some remote CSS files

5 participants