Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...
Jo Mourad

GSAP and Wordpress - Any way to "hide" .js file from being discovered? (ie with chrome dev tools)

Recommended Posts

Hello all!

 

I usually build wordpress sites and properly enqueue gsap and my custom script js files. Since i am a greensock member, i have some gsap files i don't want to be copyable from my site. However, when i inspect page, and go to network or source, i can easily find my files. There must be a way i don't know of to hide those?

 

Thanks!

Link to comment
Share on other sites

16 minutes ago, Jo Mourad said:

Hello all!

 

I usually build wordpress sites and properly enqueue gsap and my custom script js files. Since i am a greensock member, i have some gsap files i don't want to be copyable from my site. However, when i inspect page, and go to network or source, i can easily find my files. There must be a way i don't know of to hide those?

 

Thanks!

webpack build as an option😅

  • Like 1
Link to comment
Share on other sites

@OSUblake's recommended this as a simple option if build tooling is not easily set up.

It'll allow you to combine all your gsap files into a single minified file

https://jscompress.com/

Link to comment
Share on other sites

Hey, @Jo Mourad, I sure appreciate the fact that you want to protect those files - in a sense, you're showing loyalty to GreenSock. What a cool thing! But I want you to know that we don't expect you to obfuscate things like that. We know full well that if someone wants to steal the members-only plugins, they'll figure out a way. It isn't terribly difficult. So please don't feel obligated to go through extra steps to combine files or obfuscate things further, but I definitely appreciate the sentiment. 

 

Our entire business model relies on the honor system. We don't burn resources trying to hunt down violators - instead, we focus our energy on building the best tools we possibly can and offering world-class support and then we trust that the market will respond by rewarding those efforts. Club members like you do that every day, and we're so grateful for that. 🙌

 

  • Like 3
Link to comment
Share on other sites

Hey @GreenSock

 

Of course! I think my question was not formulated the way i wanted... It was less of a hide-it-i-don't-want-it-stolen, and more of a "how do other sites do it it's all tidy and clean!" I sure understand the whole honor system and find it awesome! (helped me a lot)

 

For a while now, i've been trying to figure out my whole "process" when it comes to wordpress sites, meaning minifying, cleaning, optimizing, automatizing several recurrent tasks, as i build many many wordpress sites. But in the everyday work, i never take enough time to "structure" my workflow.

 

@Cassie thanks for that! It's basically a minifier right? @JIZA i'll take a look, see? i didn't even know stuff like that existed lol!

 

Anyways guys, i can definitely say ever since i've started using GSAP, my work exponentially improved. It basically changed my life (workwise :P)

And if anyone wants to share their workflow with wordpress + gsap + etc, let me know we could chat maybe elsewhere since this isn't a wordpress forum!

 

Thanks for the awesome stuff!!

  • Like 4
Link to comment
Share on other sites

Hey @Jo Mourad,

I've built a lot of WordPress sites over the years (not many many though - guess I'm either too slow, to lazy or too bad at marketing to do so...) 

I've tried what you are trying to do several times, but in the end I've found no real silver bullet. As I do most of my design and programming by myself or with changing freelance teams, using very elaborate (build- or versioning-) systems mostly just adds overhead and additional constraints which colleague is able/wiling to join. Also most of those systems constantly evolve too and I have to say up to date with them too.

 

I used to have an 'empty' WP folder to start from as a template for a while, but it came down to an additional burden to keep that folder up to date with WP-Core, my go-to plugins (mostly ACF-Pro, WPML etc.) the current version of gsap and my own little set of  utilities.
By now my most pragmatic solution is to choose from one of my newer/well-kept projects wich seems close to the one I'm going to build, see that all relevant components are up to date, duplicate the wp folder renaming ist, adjusting styles.css, functions.php and do some folder wide search and replace for the text-domain etc. 
I'll have to do some manual correction, built new translation (po) files if required and of course  set up a database and connect in WP-config.
All of that takes max 20-40min and I'm ready to go. Keeping up a system that automates those things is (at my rate of building a new WP-Site) not efficient -  I found. But I don't do more than one per week on average, max -  and they differ al lot in complexity and style.

Regarding minifying and combining files I found after some serious testing, that for my purposes, that isn't worth the effort in all but very special cases. Nearly all servers serv with gzip compression which makes most file size gains purely academic as long as you only load what's used at some point.  A lot of very popular sites serve literally hundreds of scrips and resources from different sources and people find this acceptable, the hit from serving 1 vs. 5 js or css files from the same server seems very irrelevant to me compared to what you can gain by working with responsive images and not using large CSS and JS frameworks simply for one cool component.

 

I'm rather old school and maybe not the one to take as example, but as you asked, here is what I'm currently working with: 

 

I do my JS coding in TypeScrip (via VS-Code), which does not add any load to the customer, but is worth the effort in code quality for me.

Wherever possible I use vanillas JS  (speed), but as it is WordPress and jQuery comes with it I don't cry too much about  using jQuery when it's convenient or an older script of mine still uses it.

I use scss (same reason as TypeScript).

I do not use CSS frameworks at all, as in the end I find all of them are against the core principle of CSS of separating semantics from design and are of no use to me.

I'm not shy about lengthy CSS files, if needs be the VS-Code extension 'Comment Anchors' helps me navigate them. 

The only JS Library I voluntarily use is gsap.

 

Just my (elderly) 2 cents.

  • Thanks 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×