-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Preserve new line at end of file #492
Comments
+1 |
+2 |
It does the same thing with javascript files. I would like an option to preserve the trailing new line at the end of the file that would also add a new line at the end of the file if it doesn't already have one. |
Progress on beautifier#492 Do not feel comfortable merging yet, is it is a breaking change for node cli output to file (will strip ending newline by default now). Will ponder how important this is.
This is a slight change to the way the command-line produces output. Piped output and file output is now the same, and by default will not add a newline at the end. Ending with newline is respected when passed html beautifier to css or js beautifier. -n, --end_with_newline added to all beautifiers Fixes beautifier#492
Thanks! |
it helps if remove the extension |
For those wondering how to enable this on the command line, it is provided by the |
I may be missing something obvious here, but is there a way to have <script>
console.log()
</script>
<style>
body {}
</style> I would like the resulting markup to be... <script>
console.log()
</script>
<style>
body {}
</style> ... with a newline after `</style>. Thanks! |
@jonkri {
"end_with_newline": true,
"html": {
"js": {
"end_with_newline": false
},
"css": {
"end_with_newline": false
}
}
} |
@bitwiseman: Brilliant! Thanks a lot! 🙂 |
It triggers this "autofix". "atom-beautify":
d:
with_newline: true But my scss file still not ending with new line. I had to disable "Beautify on save" 😞 |
@nelson6e65 |
Hi, I don't think that's a formatting question. Thanks! |
Hi,
The js-beautify will remove the last new line before inside the HTML script tag. For example the new line in the following HTML script,
will be removed after js-beautify reformatted the file,
However, the problem is ESLint will complaint that a newline required at end of file but not found (eol-last).
May I know if we can configure js-beautify not to remove the last newline?
The text was updated successfully, but these errors were encountered: