Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Pure css is not comfortably maintennable. It lacks variables for example. That is massive shortcoming - inability to say that this color is same as that color. Or alternatively that this selector here is same as the one over there.

Also, even things like making stuff same height were absurdly difficult with css even absent browser differences. It is oddly inconsistent language with hard to remember rules.

And it often ends with house of card constructions that break the moment anything changes.



Actually, pure CSS can be comfortably maintained--if you're willing to limit your project to specific parameters or, simply, use a well-defined methodology (i.e. BEM, OOCSS, ITCSS, etc).

I've read some developers limit their CSS file(s) to 50 lines (max.) while other developers build their CSS on a page-by-page basis dependent on a primary global style sheet (ex: content-sidebar.css is loaded on every static page and post while content-page.css is only loaded on static pages).

Where I currently work at, every static page gets its own CSS if it meets the following two parameters: (1) accessible from the root and (2) not part of a larger (or "nested") set of pages--two rules becomes necessary when you have a team who hates nested pages and prefers an internal taxonomy system. The styles are encapsulated by adding an additional HTML class (usually a sanitized version of the page title and its ID) to the body tag.

For pure CSS websites, OOCSS will be your best friend as it forces serious thought into how you define your style rules. Additional rules also include limiting the use of CSS vars only to elements that have an ID attribute (which is also limited as well).


Unless you're still supporting IE, CSS variables are now available:

https://caniuse.com/#search=css%20variables


I use less or sass. Both have even more goodies in them.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: