-
Notifications
You must be signed in to change notification settings - Fork 118
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
LinkTagCssSource now also downloads content from @import declarations. #419
Conversation
PreMailer: - fixed obsolete DescendentsAndSelf to DescendantsAndSelf
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR, I've added a few requests for improvement.
Extracted the import logic to it's own ImportRuleCssSource class. PreMailer: - fixed obsolete DescendentsAndSelf to DescendantsAndSelf
…ring>. Changed ImportRuleCssSource (and LinkTagCssSource) to return a list of css blocks.
@whorchner I messed up my sync to your branch. I have the changes locally, will re-create. Sorry! |
@whorchner It is easiest if you can give me push access to your fork. The changes is also in the You can provide access with the checkbox in the sidebar as explained here: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/allowing-changes-to-a-pull-request-branch-created-from-a-fork#enabling-repository-maintainer-permissions-on-existing-pull-requests |
I checked the box. |
For whatever reason, I do not have permission to push. From your fork, can you try to do this: git fetch upstream pr419
git merge upstream/pr419 |
fatal: 'upstream' does not appear to be a git repository |
On my github I see the changes are gone. In visual studio local I have 11 outgoing changes. I can push or sync. Accoording to VS there are no incomming changes. |
Might it be a problem that this PR is closed? |
PR being closed is not a problem. You should be able to push your changes. |
Can you try to share the output of |
The output of 'git remote -v': |
I pushed the changes and I see them again on the github fork |
Great, now I could also push to your fork. So the PR is correct now, I refactored the import css source and added more tests. Could you try to run it with the emails you have with these nested imports? |
We have multiple stylesheet which are used separately but also combined. Some stylesheets import a variables.css stylesheet. When getting all imports the variables.css would be downloaded multiple times. So, I had to add the _importList.ContainsKey check. |
…eet in their import list, checking if the url already exists in the _importList is necessary.
Since you're the maintainer of PreMailer it is your call and I'm fine with it. My implementation breaking the ICssSource contract seems a matter of opinion, but now you have a 'source' class without the ICssSource interface, implementing a GetCss method not adhering any contract. |
So does it work? I will try to make time to add more tests, it should test the logic more sufficiently especially not downloading sources twice, the order it appends the CSS blocks.
I played around a lot, e.g. making The |
- Implemented tests for loading CSS imports recursively up to two levels. - Added caching mechanism to prevent multiple downloads of the same stylesheet. - Ensured import order is preserved when processing multiple imports. - Handled circular imports to avoid infinite loops during CSS retrieval. - Enhanced test coverage for ImportRuleCssSource functionality.
Hi Martin, I think I accidentally commit changes to this PR. I hoped to get a chance to create new PR, but that was not the case. I'm not sure how to do that, so the committed changes have to wait. If you know how to remove the commits from this PR, you are welcome to remove them. |
Try to run |
Do take a copy of the changes and keep outside of the repo. |
Thanks for the tip. It does reset locally, but it does not remove the commit from the PR. |
Remember to |
Thanks. That worked (--force). The PR is now back to wat it should be. |
PreMailer: