Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
docs: Integrate HTML and CSS style with subsystem doc.
Karl Stolleyfe1b7a9bb353
diff --git a/docs/contributing/code-style.md b/docs/contributing/code-style.mdindex 19277cc25df..8d85484d6ab 100644--- a/docs/contributing/code-style.md+++ b/docs/contributing/code-style.md@@ -30,6 +30,8 @@ outlines some generalapplicable to all languages used in the codebase, as well as specificguidance on [Python](#python-specific-conventions-and-practices) and[JavaScript and TypeScript](#javascript-and-typescript-conventions-and-practices).+([HTML and CSS](../subsystems/html-css.md) are outlined in their own+documentation.)At the end of the document, you can read about[dangerous constructs in Django](#dangerous-constructs-in-django) and@@ -213,23 +215,8 @@ avoided in new code.## HTML and CSS-Our CSS is formatted with [Prettier](https://prettier.io/). You can-ask Prettier to reformat all code via our [linter-tool](../testing/linters.md) with `./tools/lint --only=prettier --fix`.-You can also [integrate it with your-editor](https://prettier.io/docs/en/editors.html).--Avoid using the `style=` attribute unless the styling is actually-dynamic. Instead, define logical classes and put your styles in-external CSS files such as `zulip.css`.--Don't use the tag name in a selector unless you have to. In other words,-use `.foo` instead of `span.foo`. We shouldn't have to care if the tag-type changes in the future.--Additionally, multi-word class and ID values should be hyphenated,-also known as _kebab case_. In HTML, opt for `class="my-multiword-class"`,-with its corresponding CSS selector as `.my-multiword-class`.+See the documentation on [HTML and CSS](../subsystems/html-css.md)+for guidance on conventions in those language.## Dangerous constructs in Djangodiff --git a/docs/subsystems/html-css.md b/docs/subsystems/html-css.mdindex 3f3a6414a16..99546824fdc 100644--- a/docs/subsystems/html-css.md+++ b/docs/subsystems/html-css.md@@ -23,6 +23,12 @@ to learn about all the great tools that you can use to modify and testchanges to CSS interactively in-browser (without even having thereload the page!).+Our CSS is formatted with [Prettier](https://prettier.io/). You can+ask Prettier to reformat all code via our [linter+tool](../testing/linters.md) with `tools/lint --only=prettier --fix`.+You can also [integrate it with your+editor](https://prettier.io/docs/en/editors.html).+Zulip's development environment has hot code-reloading configured, sochanges made in source files will immediately take effect in openbrowser windows, either by live-updating the CSS or reloading the@@ -38,6 +44,10 @@ understand the current styling or modify it. We would very much liketo avoid such a fate. So please make an effort to reuse existingstyling, clean up now-unused CSS, etc., to keep things maintainable.+Opt to write CSS in CSS files. Avoid using the `style=` attribute in+HTML unless the styling is actually dynamic. Instead, define logical+classes and put your styles in external CSS files such as `zulip.css`.+### Be consistent with existing similar UIIdeally, do this by reusing existing CSS declarations, so that any@@ -49,6 +59,14 @@ elements.This makes it much easier to read the code and use `git grep` to findwhere a particular class is used.+Don't use the tag name in a selector unless you have to. In other words,+use `.foo` instead of `span.foo`. We shouldn't have to care if the tag+type changes in the future.++Additionally, multi-word class and ID values should be hyphenated,+also known as _kebab case_. In HTML, opt for `class="my-multiword-class"`,+with its corresponding CSS selector as `.my-multiword-class`.+## Validating CSSWhen changing any part of the Zulip CSS, it's important to check that