Here are the different coding conventions that are used inside DaPlayer's code base.
General conventions:
Foo ${bar}
rather than concatenation.if
and else
bodies are just one-line.(name) => {}
) inside regular JavaScript files
and use the classical syntax (i.e. function(name) {}
) manipulating the
DOM.array.map(param => param.name);
var foo = "bar";
var quux = "baz";
Naming conventions:
Documentation:
@return {null}
.LESS is used as the CSS pre-processor. Stylesheets are
stored under the assets/stylesheets
folder and are stored like this:
base/
contains the basic components like mixins or classes that are
too-generic to have their own file (e.g. .clearer
).components/
contains a file for each component in the application.layout/
contains layour-specific rules.default_theme.less
is the file that will be required in the index
page; it loads all the partials and defines all the variables.Here are some rules that applies to all files:
default_theme.less
, under all @import
statements (possible since variables are lazy loaded by LESS).Here are some rules that applies to class definitions:
Rules are defined in alphabetical order except width
that should be
next to height
and some rulesets (like positionning for instance).
For example:
.class {
background: red;
height: 30px;
width: 150px;
line-height: 40px;
position: absolute;
left: 60px;
top: 10px;
}
This prevents duplicates and it’s easier to read, like we are reading things by “group” (e.g. the “dimension” group, the “positionning” group)
If a rule is just a single line, you can in-line it:
.class { height: 100%; }