Newline inserted at end of <script> or <style> when `end_with_newline` enabled
See original GitHub issuejs-beautify always inserts a newline at the end of a <script>
or <style>
block, and I can’t find an option to turn this behavior off.
Before:
<style type="text/css">
body {
display: none;
}
</style>
<script type="text/javascript">
(function() {
console.log("Hello, World");
})();
</script>
After:
<style type="text/css">
body {
display: none;
}
</style>
<script type="text/javascript">
(function() {
console.log("Hello, World");
})();
</script>
If there is a newline at the start of the tag, it deletes it as well:
Before:
<style type="text/css">
body {
display: none;
}
</style>
<script type="text/javascript">
(function() {
console.log("Hello, World");
})();
</script>
After:
<style type="text/css">
body {
display: none;
}
</style>
<script type="text/javascript">
(function() {
console.log("Hello, World");
})();
</script>
Issue Analytics
- State:
- Created 9 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Why should text files end with a newline? - Stack Overflow
If content is added to the end of the file, then the line that was previously the last line will have been edited...
Read more >How to disable vscode auto format adding newline at EOF
VS versions: config.json: { "workbench.colorTheme": "Monokai", "editor.fontSize": 16, "editor.formatOnPaste": true, // Format a file on save ...
Read more >Should I end my text/script files with a newline? [duplicate]
An empty line at the end means that the file ends in two newline characters. If the file ends with a single newline...
Read more >On save new line added to end of file. How stop this?
When I save a file, PhpStorm adds a new line to the end of the file. ... You either enable it or disable...
Read more >js-beautify - npm
The beautifier can be added on your page as web library. ... --end-with-newline End output with newline -b, --brace-style [collapse|expand] ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This has been addressed and resolved (with tests) when I checked using v1.8.0-rc12. See the Readme (https://github.com/beautify-web/js-beautify#setting-inheritance-and-language-specific-overrides) for more information. This is also the case for Issue #639.
Any news on this? I’m facing the same issue. This is a little annoying when working with Vue, where you have the
script
andstyle
tags on the same file.