0

I'm trying to add some features to a third-party chrome addon that injects code into an existing website. This code is inline (i.e. not an external javascript file) and is minified. I want to insert some break points in the code to work out what is going on.

There are lots of ways to beauitfy minified script files (also this)

Is there a way to beautify <script> tags in an html file?

Research so far

Alternatives

I admitted defeat on this approach for the moment and am trying editing the extension following this question for expansion and this question for command line beautification I'm not sure this will be too relevant for other readers though...

Att Righ
  • 1,439
  • 1
  • 16
  • 29
  • 1
    I wasn't the downvoter, but the title says "in Chrome" and you dropped a Firefox bug report. Chrome does support pretty printing the entire html file on the Sources tab of the F12 devtools. – Luke Briggs Jul 31 '22 at 16:49
  • Yeah... my hope was that the workaround suggested in firefox would also work in chrome. – Att Righ Jul 31 '22 at 16:52
  • 1
    Chrome doesn't need the workaround as it's a built in feature :) On the sources tab (the same one in the linked question), look for `(index)`. If you [pretty print that](https://i.imgur.com/YtCMNBu.png) it'll be the whole html file, including any inline script elements. – Luke Briggs Jul 31 '22 at 16:56
  • 1
    What about source maps (.map)? – Ouroborus Jul 31 '22 at 17:57
  • @LukeBriggs thanks. Hmm... what I really want is *break points*. I guess another approach is to unpack the extension and mess with it.... – Att Righ Jul 31 '22 at 18:02
  • So exciting question! Can you give us a real example of website where you'ld like to do this? :) – Ricardo Machado Jul 31 '22 at 19:22
  • @RicardoMachado my actual use case is hacking extra features into [language reactor](https://www.languagereactor.com/) that turns netflix into a language learning tool. It's very good... so good that I want to tweak it. What I really want is for this to all be open source... but that's not going to happen. I suspect I might grow my open api for netflix over time based on this work. I found [this](https://github.com/avigoldman/netflix.js) that perhaps wants to be extended. – Att Righ Jul 31 '22 at 19:23

0 Answers0