-
-
Notifications
You must be signed in to change notification settings - Fork 23
Coding Standards
Taufik Nurrohman edited this page Oct 22, 2021
·
31 revisions
Mecha mostly contains CSS, HTML, JavaScript, JSON, PHP, and YAML files.
Use two <Space>
s to represent single indent.
@foo bar {
foo {
bar: 1px;
}
}
Add a <Space>
after colon.
@foo (bar: baz) {
foo {
bar: baz;
}
}
Ensure semi-colon at the end of declaration.
foo {
bar: 1px;
baz: 1px;
}
Remove unit in zero values except 0%
and 0deg
.
foo {
bar: 0 0 1px 1px;
baz: 0%;
}
Always remove zero prefix in fractions.
foo {
bar: .25em .5em;
baz: 1.25em;
}
Add a line-break after comma, sort selectors alphabetically.
h1,
h2,
h3,
h4,
h5,
h6 {}
Use single quote for attribute selector value, and for non-empty string value. Use double quote for empty string value.
[foo='bar'] {
baz: "";
qux: foo('bar');
}
Sort declarations alphabetically, unless you want to override the previous declaration.
foo {
bar: 1px baz #000;
bar-baz: 0;
foo: 1px;
qux: 1px;
}
Use two <Space>
s to represent single indent.
<foo>
<bar></bar>
<baz></baz>
</foo>
Use lower-case letter, sort attributes alphabetically.
<foo bar="1" baz="1" qux="1">
Always remove values.
<foo bar baz='qux'>
Always use double quote, even on empty value.
<foo bar="" baz="1">
Do not add /
before >
in void elements.
<img alt="" src="/photo.jpg">
<hr>