[Owncloud] Question about code styling: single line CSS
Jan-Christoph Borchardt
hey at jancborchardt.net
Sat Aug 11 12:02:01 UTC 2012
True story. This was good in the beginning, but as the CSS grows
bigger and bigger and more people work on it, it stops scaling. I’ll
go through the CSS files the next days and clean it up.
I’ll not do pure one-line-per-attribute though but rather a mix, as
one-attribute per-line is a pain for scannability of selectors.
Instead of alphabetic sorting (which makes 0 sense), attributes will
be grouped by relevance. One row for position-related things, one row
for typeface, one row for colors, one row for additional.
If there are only one or a few attributes in the selector, it will
still be single-line though.
Also, the selectors will be indented to visualize their relation a bit better.
Let me know what you think.
On Sat, Aug 11, 2012 at 3:05 AM, Bernhard Posselt <nukeawhale at gmail.com> wrote:
> Hi,
>
> I've just started to dig into some app developement and i came across
> this code styling rule:
>
> * CSS in single-line notation
>
> I normally don't have anything against coding style guidelines but I
> think this one really hurts readability, as it requires you to not only
> scroll vertically but also horizontally. Further problems are:
>
> * Less readability for single CSS statements
> * Unreadable diffs (git shows that the whole line has been replaced,
> instead of a single statement)
> * Looong lines if you go for CSS prefixes, especially animations
> * Harder to add new statements to a CSS rule
>
> The only advantage is that you can quickly scan for certain rules, but
> to be honest, this should be provided by your Editor/IDE (Theres
> normally a symbol browser that also works for CSS rules like
> http://www.micahcarrick.com/mc_images/screenshots/gedit/gedit.png)
>
> To provide further arguments:
> http://www.robbiemanson.com/articles/reasons-to-avoid-single-line-css/
> http://neutroncreations.com/blog/single-line-vs-multi-line-css-plus-textmate-tips/
>
> Also take a look at:
> http://www.python.org/dev/peps/pep-0008/#maximum-line-length
>
> I usually style my CSS like this:
> https://github.com/Raydiation/oberthmedia/blob/master/oberthmedia/homepage/static/homepage/style/style.css
> but I'm not sure if its the best method :P.
>
> regards
>
> Bernhard Posselt
>
> _______________________________________________
> Owncloud mailing list
> Owncloud at kde.org
> https://mail.kde.org/mailman/listinfo/owncloud
More information about the Owncloud
mailing list