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

Remove JQuery #74

Closed
mathieubrun opened this issue May 3, 2018 · 10 comments
Closed

Remove JQuery #74

mathieubrun opened this issue May 3, 2018 · 10 comments

Comments

@mathieubrun
Copy link
Contributor

FIrst, thanks for the great theme !

JQuery does not seem to be required, removing it may shave a few KB and improve page load speed :)

I had it working on my site here : https://github.com/mathieubrun/mathieubrun.github.io

If you want I can fork and make a PR ?

@sylhare
Copy link
Owner

sylhare commented May 4, 2018

Hi

Actually JQuery is used for the gallery page, the portfolio page and also to make the image in the post header to move as it is scrolled.

It could be possible to add a condition but I don't think that's worth the change (The file is charged after a couple of microseconds here for 84.6 KB) while the picture is a couple MB.
I can see issue coming with people having pages not working because JQuery was not put 'on'.

@yshrsmz
Copy link
Contributor

yshrsmz commented May 4, 2018

what about using CDN instead of loading our own copy, so that we can possibly use a cache from other site?

@sylhare
Copy link
Owner

sylhare commented May 4, 2018

Yeah, I had something like that in mind, a flag for everything to be loaded locally (every vendor scripts if enabled) and a flag for everything loaded from the CDN. That could be a good feature 👍

@mathieubrun
Copy link
Contributor Author

@sylhare yes it's small compared to the images (I'm having a look at those at the moment), but I wanted to see if I could remove it ;)

I did not see the gallery dependency on jquery when I did it locally.

@sylhare
Copy link
Owner

sylhare commented May 9, 2018

@mathieubrun, true the masonry library seems not to need JQuery to work, however I used JQuery to initialize it. Probably by converting all of the JQuery to vanilla javascript you would kill the JQuery dependancy apart from the bootstrap portfolio.

That could be an even better solution 🤔 wouldn't it?

@mathieubrun
Copy link
Contributor Author

@sylhare yes this could be done. I had the snippet for the scrolling and the css. Regarding the portfolio, it looks like you're not using any bootstrap component that is using JS. The bootstrap js could be removed then. Also, you could switch to flexbox layout ( https://caniuse.com/#feat=flexbox ) and ditch bootstrap as well ?

@sylhare
Copy link
Owner

sylhare commented May 9, 2018

Yup, I was thinking toward making that move. So here are the tasks that I see to remove JQuery (I'll create another for the bootstrap to felxbox):

  • Rewrite navbar.js without jquery
  • Create a masonry_init.js ( like the katex_init) to go with the gallery (instead of having it in the layout)
  • Rewrite the masonry_init.js wihtout jquery

If you want to help on some, let me know. 😉It is greatly appreciated!

sylhare added a commit that referenced this issue May 9, 2018
@mathieubrun
Copy link
Contributor Author

Done on my fork, just need to do some checks with IE !

@sylhare
Copy link
Owner

sylhare commented May 10, 2018

Amazing! I will review the PR once you are ready 😁
It feels like JQuery might soon be gone from the theme after all!

sylhare added a commit that referenced this issue May 10, 2018
Removed jquery dependency from navbar #74
sylhare added a commit that referenced this issue May 10, 2018
@sylhare
Copy link
Owner

sylhare commented May 10, 2018

JQuery is now removed from the theme 🎉
Big thanks to @mathieubrun !

@sylhare sylhare closed this as completed May 10, 2018
OMEGA-Y pushed a commit to OMEGA-Y/OMEGA-Y.github.io that referenced this issue Dec 8, 2020
Add Adam Morris as a JavaScript contributing maintainer
gmoon92 pushed a commit to gmoon92/gmoon92.github.io that referenced this issue Oct 5, 2021
gmoon92 pushed a commit to gmoon92/gmoon92.github.io that referenced this issue Oct 5, 2021
Removed jquery dependency from navbar sylhare#74
gmoon92 pushed a commit to gmoon92/gmoon92.github.io that referenced this issue Oct 5, 2021
gmoon92 added a commit to gmoon92/gmoon92.github.io that referenced this issue Mar 8, 2022
gmoon92 added a commit to gmoon92/gmoon92.github.io that referenced this issue Mar 8, 2022
Removed jquery dependency from navbar sylhare#74
gmoon92 added a commit to gmoon92/gmoon92.github.io that referenced this issue Mar 8, 2022
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