-
Notifications
You must be signed in to change notification settings - Fork 126
Improve readability and consistency of Sugar HTML code style guidelines #239
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,22 +1,30 @@ | ||
| Code style for Sugar HTML development | ||
| ===================================== | ||
|
|
||
| This document defines the code style guidelines for HTML-based Sugar | ||
| development. Following these conventions ensures consistency, | ||
| readability, and compatibility with Sugar’s “View Source” feature. | ||
| General | ||
| ------- | ||
|
|
||
| * Avoid lines longer than 80 characters. | ||
| * Avoid lines longer than 80 characters to improve readability, | ||
| especially when viewing source code inside Sugar. | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I honestly don't see how this is better, stating when viewing source code inside Sugar doesn't mean much as not a lot of contributors do that. |
||
|
|
||
| * Don't use any form of minification (neither in JS, HTML or CSS). | ||
| All our source should be readable using the Sugar "View Source" | ||
| feature. | ||
|
|
||
| ### HTML | ||
|
|
||
| * Use two spaces for indentation. The rationale is that HTML tends to | ||
| be very nested, and avoiding lines longer than 80 characters becomes | ||
| difficult. | ||
| ## HTML | ||
|
|
||
| * Use **two spaces** for indentation. | ||
| HTML files are often deeply nested, and two spaces help keep lines | ||
| under 80 characters. | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm really finding it hard to see how this is better than what's already there. |
||
|
|
||
| The js-beautify tool can be handy for indenting HTML as well. | ||
| * Do not minify HTML files. | ||
|
|
||
| ### Helpful Tools | ||
| - `js-beautify` can be used to format and re-indent HTML code. | ||
|
|
||
| ### CSS | ||
|
|
||
|
|
@@ -26,7 +34,9 @@ The js-beautify tool can be handy for indenting HTML as well. | |
|
|
||
| ### JavaScript | ||
|
|
||
| * The JavaScript style guide is [here](./javascript-style.md) | ||
| JavaScript code must follow the Sugar JavaScript style guide: | ||
| - [JavaScript Style Guide](./javascript-style.md) | ||
|
|
||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I prefer the hyperlink being inline when "JavaScript style guide" is mentioned.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I’ll push an update shortly that removes these explanatory additions and focuses only on formatting/consistency improvements that clearly add value. |
||
|
|
||
| Tools | ||
| ----- | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sugar's "View Source" feature? I don't see how that relates here.
You should also look at how your changes show up in markdown, I doubt that's what you intend.
I also don't see how this line improves readability and consistency.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You’re right about the “View Source” reference. That context doesn’t really add value here, and I’ll remove it to keep the guideline more generally applicable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm curious, how did you get there in the first place?