gotdibbs / Imposter

Imposter looks for requests matching a base url and then swaps them for a local file.
4 stars 2 forks source link

Allow single to multiple #9

Open rhessinger opened 9 years ago

rhessinger commented 9 years ago

It would be awesome if it could take one script and have it load multiple scripts. The situation i have found is that i use Web Grease bundling with javascript and it would be nice to make my bundle actually load multiple files when using imposter.

gotdibbs commented 9 years ago

@rhessinger That's a good idea. Not sure if I'll have time to get to it soon but you're welcome to take a stab at it and submit a PR OR you could replace your one script file with a loader script which would tackle appending all the necessary script tags to the DOM.

rhessinger commented 9 years ago

Thanks for the suggestion, I will take a look and see what i can do myself.

gotdibbs commented 9 years ago

Sure thing. Let me know if I can help with the script loader. I've done that a couple times.

To be clear, you wouldn't need to append the entire script, just a script tag with a source URL that Imposter is set to respond to.

rhessinger commented 9 years ago

@gotdibbs So I was taking a look at this over the weekend and my thought was to basically generate a script loader dynamically from the mapped files and write the response as a stream back through fiddler, which then should scan the directory to find the scripts. The idea would be to add a flag to the overrides that states if this should use a script loader and then include the files in the path box separated by commas. What are your thoughts on that? I was also thinking to add the file picker in so you can use a multi-select for files to get the paths to add ease of use.

gotdibbs commented 9 years ago

@rhessinger Sorry for the delay! I think some more complex UI may be required. I was originally thinking a multi-select file picker would be perfect, but then I remembered you might actually care about the order by which the files are concatenated together. Feel free to take a stab at whatever works for you though and I'll take a look.