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

Override File with dynamic names #43

Open
jmscavaleiro opened this issue Dec 10, 2020 · 4 comments
Open

Override File with dynamic names #43

jmscavaleiro opened this issue Dec 10, 2020 · 4 comments

Comments

@jmscavaleiro
Copy link

Hi,

Any way to override a js file which is served each time with a new name with a fixed number of characters?

I believe it's a good feature to add if it's not possible to do it yet. Is there any idea if it's possible to make it? I can offer myself to develop it.

Kind regards.

@kylepaulsen
Copy link
Owner

kylepaulsen commented Dec 10, 2020

if the file name has no patterns to it (other than having a .js at the end) then yeah the best you can do is something like:
https://somesite.com/js/*.js
which would obv overwrite everything that ends in js. However! you can also have overrides go to the original location like this:
https://somesite.com/js/main.js -> https://somesite.com/js/main.js
Seems pointless right? Well, if you put this rule above the rule with the * in it, then main.js wont get overridden.

But yeah if all js files have random names and you only want to override one of them, then I'm not sure what to do.

Maybe block all scripts and then copy paste and inject each script.

@jmscavaleiro
Copy link
Author

jmscavaleiro commented Dec 10, 2020

Hi Kyle!

Many thanks for your answer. But there is a way: (not The Mandalorian one but it could 😉)

Do you have a way to read the file name of the source that will be override and give your file the same name?

We can divide the feature in two:

  1. If the source folder only have one file it will be pretty straightforward.
  2. If the folder contains more than a file, the system must identify which file to override based on a couple of rules. For instance: the number of lines of code inside each and match with the desired file based on it. Or if it finds a specific string inside it. Or simply put (but maybe hardly done): the user could decide in runtime whitch file should match to override.

What do you think? It's doable?

Kind regards,
João Cavaleiro

@jmscavaleiro
Copy link
Author

Hi Kyle,

I am willing to develop the above suggested features. Is it okay for you to fork the code and go ahead?

Kind regards,
João Cavaleiro

@kylepaulsen
Copy link
Owner

I am no longer accepting PRs for this repo unless for critical basic functionality bug fixes. This project has been in maintenance mode ( https://github.com/kylepaulsen/ResourceOverride/blob/master/maintenance_notice.md ) for a while now.

You are free to do whatever you like with the code, so long as you follow the included license. https://github.com/kylepaulsen/ResourceOverride/blob/master/LICENSE

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