HookyQR / VSCodeBeautify

Enable js-beautify (https://github.com/beautify-web/js-beautify) in VS Code
MIT License
605 stars 180 forks source link

VSCodeBeautify has deleted Django tags within a <scritp> section, in a Django html template file. #360

Open stevechenzy opened 4 years ago

stevechenzy commented 4 years ago

in a Django html template file, there is a section of tags?

EDIT - BETTER WORKAROUND TO SEPARATE HTML and JAVASCRIPT I've learned of: https://docs.djangoproject.com/en/3.0/ref/templates/builtins/#json-script which is the new recommended way of passing data to javascript.

It does turn it to two lines of code however you can have {{ value|json_script:"hello-data" }} in your html

then just load a javascript file (below the above line) with the following embedded in it: const value = JSON.parse(document.getElementById('hello-data').textContent);

7iomka commented 3 years ago

@ihelmer07 It is possible to skip formatting inbetween ? How?