question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unable to beautify the js code in html files

See original GitHub issue

Versions: beautify - 0.4.1 vsCode - 1.5.2

Settings:

"beautify.onSave": true,
    "beautify.JSfiles": [
        "html",
        "js",
        "json",
        "jsbeautifyrc",
        "jshintrc"
    ]

Before Formatting: image

After Formatting: image

As you can see, the alignment/formatting of js code inside the html file is not working. Where as if its in a .js file, its working like charm.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
HookyQRcommented, Oct 17, 2016

If you don’t use a .jsbeautifyrc file, we use your vscode settings. Unfortunately, the default for "html.format.unformatted" includes script. Add this setting to you user settings and remove the script, from the list.

The default: "html.format.unformatted": "a, abbr, acronym, b, bdo, big, br, button, cite, code, dfn, em, i, img, input, kbd, label, map, object, q, samp, script, select, small, span, strong, sub, sup, textarea, tt, var"

0reactions
HookyQRcommented, Oct 18, 2016

You’re welcome.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Prettier not formatting HTML files in VS Code - Stack Overflow
I simply solved it by right-clicking in the file, select 'Format Document with' and choose 'prettier ...
Read more >
CodeMix & Angular IDE - Genuitec
To enable Beautify for a particular file extension, you can either do it from the editor or add this flag to the settings...
Read more >
js-beautify - npm
Start using js-beautify in your project by running `npm i js-beautify`. ... HTML or CSS files, but you can install css-beautify for CSS:....
Read more >
Handling common JavaScript problems - MDN Web Docs
We are going to write code to fetch the flowers image and display it in the page. Next, save a copy of the...
Read more >
Vue JavaScript Tutorial in Visual Studio Code
VS Code will launch and display your Vue application in the File Explorer. Vetur extension. Now expand the src folder and select the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found