pcfreak30 / rocket-footer-js

WordPress plugin to force all JS to the footer including inline scripts. Extends WP-Rocket
GNU General Public License v2.0
16 stars 1 forks source link

I want to add my external js to footer without minifying to ONE file. #1

Closed tosunkaya closed 7 years ago

tosunkaya commented 8 years ago

Hi, i want to add my jquery core and jquery migrate external cdn url js's to footer without combined to ONE js file. How can i do this? Please help me.

like exclude jquery url's.

jquery jquery migrate other one js file.

pcfreak30 commented 8 years ago

Is there a reason that you need this? Ideally you should want to only have 1 JS file as it means less requests to the server. Currently the only way is to do data-no-minify="1" on the script tag however you wish to accomplish that.

tosunkaya commented 7 years ago

Will try. Because of jquery (external js) cdn is faster than my cdn. Will it work for this?

pcfreak30 commented 7 years ago

If jquery externally is faster, get a better CDN. I recommend using cloudflare free with a cdn subdomain proceed. No reason to use 3rd parties unneededly.

tosunkaya commented 7 years ago

Jquery's cdn is faster beacuse of the people already loaded on other websites. Thats why im using. And my cdn is cdn77. Already using cloudflare.

pcfreak30 commented 7 years ago

beacuse of the people already loaded on other website explain please?

ghost commented 7 years ago

Is there a reason that you need this?

Absolutely.

Fetch Inject

https://github.com/jhabdas/fetch-inject

ghost commented 7 years ago

If jquery externally is faster, get a better CDN.

For those using CloudFlare, please read up on CloudBleed. You may have been affected. CloudFront, the CDN I use, was not affected by CloudBleed.

pcfreak30 commented 7 years ago

@jhabdas i personally never use their proxy, but a separate subdomain as to not process html. If not proxying the whole site then I dont see you being at risk for cloudbleed.

tosunkaya commented 7 years ago

hi i really need this plugin without combine external js's so i want external js's as same. lots of website uses jquery cdn and when they came to my website no need to redownload jquery. please help me.

pcfreak30 commented 7 years ago

In my opinion it is still going to be faster to have your single bundle that you can control vs relying on a external CDN you don't. I dont see the logic that because others use a CDN with jquery that means if you use it, they will load faster, as that cuts out the ones that don't. You are better off getting your site on a CDN and things will load very fast regardless.

ghost commented 7 years ago

Single bundles are bloated. Typically with oodles of UMD wrappers, because they're built using Node the cajoled to work on the Web using Webcrap. I mean Webpack. And oftentimes with all sorts of stuff needed by a single page on a site the current page doesn't need. Or, if the page does need it, it has to wait for the entire payload to download, parse and execute. And that prevents simple lazyloading techniques which can dramatically inprove page performance.

Anyway. Even if you are bundling, it's still more efficient to load things over CDN unless your app scales horizontally (by clustering app instances behind a load balancer), especially vendor libs like jQuery.

But don't take it from me. I'm not here to give conjecture. Just do the testing yourself and you will see.

https://habd.as/monitor-pwa-website-performance/

tosunkaya commented 7 years ago

Hi also im using ads services (publishing adsense+other ads) via external js files. When i use this awesome plugin, ads doesnt show up because of combining everything to one file. How can i exclude externals on this plugin? Ads js's are top of the website source, ads js's are loading before main site elements. My website https://tosunkaya.com (just changed the theme)

ghost commented 7 years ago

First you need to understand: https://hackcabin.com/post/managing-async-dependencies-javascript/

tosunkaya commented 7 years ago

My ads js's are already async but if you look to my website source, you can see ads codes on the above/top.

● Anyway can i exclude external js's like jquery js on this plugin? ● Jquery CDN (cdnjs by cloudflare) or my CDN (cdn77) static.tosunkaya.com

ghost commented 7 years ago

Unless it's specific to this plugin it should probably go to StackOverflow

tosunkaya commented 7 years ago

Do you recommend my cdn (cdn77) over jquery's on cdnjs? If you recommend i will load jquery from wordpress and use my cdn for jquery.

pcfreak30 commented 7 years ago

Use a3 lazy load with this plugin to lazy load ads too :). And yes, use your CDN for everything so you have control. Though pro tip: Use a sub domain on cloudflare (proxied) and get free CDN for life + wp-rocket integration.

@jhabdas who are you talking to with https://hackcabin.com/post/managing-async-dependencies-javascript/?

tosunkaya commented 7 years ago

Thanks for everthing. I will do presently. I am already using cloudflare for all website with proxy.

You mean disable proxy for main domain and create a subdomain with proxy (dns thing), will work better than "as it is now"? But My CDN has more locations than Cloudflare.

Can i use this for "cookie free domains" also? I asked too thing, sorry for this :)

pcfreak30 commented 7 years ago

The cookie free domain things I tend to ignore. And CF has 102 DC's. I havent seen any cdn with that. And If you have CF proxying your whole domain, CDN77 is not needed. I just dont like using it on the whole site due to cloudbleed and other reasons, but thats just my opinion.

ghost commented 7 years ago

@jhabdas who are you talking to with https://hackcabin.com/post/managing-async-dependencies-javascript/?

Everyone