How to Beautify/Prettify the text?

Is there any way to beautify the JS and/or HTML and/or CSS? Text gets messy quite quickly and it’s a pain to just copy/paste to a different editor, only to copy/paste back into Glitch.

Thanks!

Nothing official just yet, but another Glitch user did create this bookmarklet to use prettier: https://prettier.glitch.me/

1 Like

I’m having trouble with this now, getting this error in the console about violating security policy

Hi @madmaxlax,

Thanks for the report, we recently updated our Content Security Policy on glitch.com to reduce the risk of XSS and other potential security issues.

We’ll take a look and see if there is a good compromise to allowing 3rd party services while maintaining rigorous security.

Thanks again for reporting this!

Hey all, I created a new version to solve this problem, you can check it out here. It does not require a REST service to perform the job:

https://prettier-new.glitch.me/

1 Like

Since version 1.13, Prettier supports running directly in the browser. It should be possible to do the actual formatting in a web worker to keep the UI responsive. As a Prettier maintainer, if the Glitch team needs any help while adding this feature, feel free to DM me!

2 Likes