3 ms·
> Most layout issues JavaScript packages attempt to solve, like box placement, alignment, and sizing, managing text overflow, and even entire layout systems, ar
by azangru 8y ago
> Most layout issues JavaScript packages attempt to solve, like box placement, alignment, and sizing, managing text overflow, and even entire layout systems, are solvable with CSS today.
This paragraph has surprising links. "Managing text overflow" links to Shave, a library for truncating multiline text[0]. Last time I checked, CSS was capable of truncating single-line text, but could not truncate multiline text (the line-clamp rule is still not universally supported). The first link in that paragraph is to a flexbox polyfill, and obviously, there's a reason why people use polyfills.
[0] - https://www.npmjs.com/package/shave https://www.npmjs.com/package/shave
- comis 8y agoYea there's plenty of benefits using a truncation library (we're currently using react-lines-ellipsis) over just css truncation. More control over how the truncation happens, callback so you can do more stuff on the condition that truncation has occurred, multi-line truncation as you mentioned, etc etc. I get the feeling that most of the time when people are complaining about unnecessary libraries they simply haven't personally run into the problem that the library solves yet.
- draw_down 8y ago> I get the feeling that most of the time when people are complaining about unnecessary libraries they simply haven't personally run into the problem that the library solves yet. Ding ding ding. "CSS does that!" is such an easy meme to replicate. Let's all try to consider that web developers are not just insane freaks who love to put JavaScript where it doesn't belong, and instead just regular people trying to solve problems like anyone else.