Open kairos666 opened 8 years ago
the next version will allow you to just provide a function that receives the entire document, and you return whatever you want from it. So then you could parse it using whatever tools you like.
I've made up a middleware that does just that with cheerio (jsDom + custom JQuery). Works fine but I've got some few caching issues.
It makes sense to have such a feature out of the bs box. Sounds great. Thanks.
@shakyShane Is there a function to receive the entire document now? Couldn't find anything in the docs.
First of all, BrowserSync is awesome :) Second, hopefully this feature is already feasible therefore it is a noob question.
problem
I proxy an external URL and need to modify HTML requests on the fly (I don't have access to this external HTML source). So at the end, on the browser, I should get a mix of the proxied HTML and my own.
RewriteRules gives me exactly this. problem solved! ... BUT ... working with regexp is really a pain. I need to select specific html tags and their content before rewriting them.
I would prefer an approach with a parsed DOM (jsdom, harmon/trumpet, ...) so that i can easily manipulate the HTML with jQuery like selectors. Unfortunately i couldn't find a recipe to do just that.
Any suggestions?