Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 17 additions & 7 deletions src/web-style.md
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.
Copy link
Member

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.

Copy link
Author

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.

Copy link
Member

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?

General
-------

* Avoid lines longer than 80 characters.
* Avoid lines longer than 80 characters to improve readability,
especially when viewing source code inside Sugar.
Copy link
Member

@chimosky chimosky Jan 19, 2026

Choose a reason for hiding this comment

The 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.
Copy link
Member

Choose a reason for hiding this comment

The 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

Expand All @@ -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)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I prefer the hyperlink being inline when "JavaScript style guide" is mentioned.

Copy link
Author

Choose a reason for hiding this comment

The 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
-----
Expand Down