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

Is it possible to prevent content to be reloaded ? #4

Closed
LilaRest opened this issue Jan 7, 2020 · 8 comments
Closed

Is it possible to prevent content to be reloaded ? #4

LilaRest opened this issue Jan 7, 2020 · 8 comments

Comments

@LilaRest
Copy link

LilaRest commented Jan 7, 2020

Like the SwupScriptsPlugin with the 'data-swup-ignore-script' attribute in scripts tags, is it possible to insert specific attributes into link tags to prevent them to be reloaded ?

@LilaRest
Copy link
Author

LilaRest commented Jan 7, 2020

I've created a fork to implement this functionality : https://github.com/LilianCruanes/head-plugin
And also send a pull request.
See you.

@gmrchk
Copy link
Member

gmrchk commented Feb 25, 2020

Hey, thanks for the PR!

Can you explain a use case for this? If the tag is in the head tag of the page source, why wouldn't it be replaced by the head plugin? This would introduce an inconsistency from the actual page source, where I don't see reason, but maybe I'm missing something.

@LilaRest
Copy link
Author

Hi ! Let me explain one of my use cases :
Jinja style templates (like Django's templates for example), allow users to create base pages from which others pages can inherit.
In the project on which I actually work there is a nav bar and only the content bellow the nav bar is replaced.
If the style of the nav bar isn't fixed we can observe a 'flash' effect during page's transition cause the navbar style is removed then re-applied.

It is also nice to have a 'general' style in which all common content is inserted, it reduces request's number as well as files' sizes and so increases speed of the website.

@gmrchk
Copy link
Member

gmrchk commented Mar 1, 2020

In case an HTML tag is present in both, current and future head tag, the plugin will compare the two, and won't replace it at all, so the blinking shouldn't occur. If some blinking is present, there is a bug in a plugin, or the HTML tags are not identical. I would need a demo to check what's the issue.

I'm guessing if we make it work as expected, this change in the plugin is not necessary.

@LilaRest
Copy link
Author

LilaRest commented Mar 1, 2020

Don't have time to deploy a demo, sorry... But I can say to you : Yes it is blinking and yes scripts was the same !

@gmrchk
Copy link
Member

gmrchk commented Mar 1, 2020

Double checked and the plugin seems to work as expected for me - if the style tag (like below) is present in both pages, the plugin doesn't replace it and no blinking is present, so I can't reproduce the problem.

<link rel="stylesheet" href="/assets/frontend/css/main.css">

Unfortunately, I can't help if I can't see the problem.

@LilaRest
Copy link
Author

LilaRest commented Mar 1, 2020

I will try another time on the project on which I'm currently working. I'll let you know

@gmrchk gmrchk closed this as completed Jun 7, 2020
@gmrchk
Copy link
Member

gmrchk commented Jun 7, 2020

Please, feel free to open new issue if you happen to have a demo we could check.

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

2 participants