Doc: WebHost: update readme and style guide (#4853)

* Doc: WebHost living standard

* Docs: update style guide for HTML, CSS and JS

* Unblame phar

* Too many words

* The better choice

* More rules

* Removed too much

* Docs: add recommendations for script defer and async
This commit is contained in:
black-sliver
2026-01-28 19:57:12 +00:00
committed by GitHub
parent a6740e7be3
commit 9b421450b1
2 changed files with 27 additions and 47 deletions

View File

@@ -47,21 +47,27 @@
## HTML
* Indent with 2 spaces for new code.
* Indent with 4 spaces for new code.
* kebab-case for ids and classes.
* Avoid using on* attributes (onclick, etc.).
## CSS
## CSS / SCSS
* Indent with 2 spaces for new code.
* Indent with 4 spaces for new code.
* `{` on the same line as the selector.
* No space between selector and `{`.
* Space between selector and `{`.
## JS
* Indent with 2 spaces.
* Indent `case` inside `switch ` with 2 spaces.
* Use single quotes.
* Indent with 4 spaces.
* Indent `case` inside `switch ` with 4 spaces.
* Prefer double quotation marks (`"`).
* Semicolons are required after every statement.
* Use [IIFEs](https://developer.mozilla.org/docs/Glossary/IIFE) to avoid polluting global scope.
* Prefer to use [defer](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/script#defer)
in script tags, which retains order of execution but does not block.
* Avoid `<script async ...` in most cases, see [async and defer](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/script#async_and_defer).
* Use addEventListener.
## KV