Hirse / brackets-beautify

Brackets Extension to beautify JavaScript, HTML, and CSS files.
MIT License
34 stars 3 forks source link

Beautify on save duplicates markup in live preview #14

Closed misterManSam closed 8 years ago

misterManSam commented 8 years ago

When "Beautify on save" is enabled, the markup is displayed twice in the live preview when saved.

To recreate:

  1. Enable "Beautify on save"
  2. Markup a page
  3. Make some sloppy indentation
  4. Open a live preview
  5. Save the document

Brackets

Release 1.4 build 1.4.0-16380 (release 273804eb3) build timestamp: Mon Jul 27 2015 07:23:52 GMT+0100

Screencast: Youtube link

Screenshot: Example

David-Else commented 8 years ago

This happens for me too! It also happens when I press ctrl+alt+b. It does not always happen, but very often. I can't seem to pin down exactly when.

I am running Windows 7 and the last official Brackets Release 1.4 build 1.4.0-16380 (release 273804eb3) and Chrome Version 45.0.2454.101 m.

Really hope this can get fixed as it's making this amazing extension unusable at the moment.

Hirse commented 8 years ago

For the Beautify-On-Save functionality I have used a similar approach as MiguelCastillo's Brackets-wsSanitizer, but that extension does not seem to have this issue. I am going to see where the difference lie and try to fix this.

David-Else commented 8 years ago

Great news, good luck!

Hirse commented 8 years ago

After searching through my code for a long time and not finding anything, I decided to check if this had been reported with Brackets itself. It turns out it has: Apparently this happens when you replace the <html>-tag in the document: https://github.com/adobe/brackets/issues/10634 Unfortunately, there is no fix for it yet and one possible PR is somewhat stuck in the validation phase: https://github.com/adobe/brackets/pull/10653

I will see if I can find a workaround, but in the worst case, I would just disable Beautify-On-Save on html files when live preview is enabled.

Hirse commented 8 years ago

I think I have found a work-around: If the LivePreview is active, only beautify content inside <html>. Please install the extension from URL and check if that works for you.

Denisov21 commented 8 years ago

Yes, I tried it works perfectly @Hirse! With version 2.2

brackets-beautify-updater commented 8 years ago

Great