News for hackers. Stuff that matters.
Re:Shoelace.css – A back to the basics CSS starter kit by cornedor on Tuesday August 01, 2017 @06:29AM (#14899276)
A lot of styles are being applied without you having to set a class. For example, all tables are styled. This can get in the way really fast if you want to do your own styles for a element.
Re:Shoelace.css – A back to the basics CSS starter kit by claviska on Tuesday August 01, 2017 @08:13AM (#14899830)
Someone else asked this so figured I'd share my response: https://github.com/claviska/shoelace-css/issues/12#issuecomm...
Re:Shoelace.css – A back to the basics CSS starter kit by SippinLean on Tuesday August 01, 2017 @10:21AM (#14900884)
>I've never used a <table> without <table class="table">. It's redundant.

It's not redundant, an element selector has a different specificity than a class selector. Much easier to maintain when Everything Is A Class (especially when paired with BEM, for very flat selectors). It's the reason Bootstrap stopped doing this.

Who cares if it's redundant? Classes are cheap and repeated strings cost you almost nothing after Gzip.

Re:Shoelace.css – A back to the basics CSS starter kit by claviska on Tuesday August 01, 2017 @11:13AM (#14901507)
So should we use <h1 class="h1"> and <a class="a">? It's redundant. Shoelace provides a reset + minimal, default, and customizable styles. You can use variables and also modifiers to change those styles. It's not Bootstrap. Different paradigm.
Re:Shoelace.css – A back to the basics CSS starter kit by SippinLean on Tuesday August 01, 2017 @11:37AM (#14901832)
Yes! First I should point out that "reset"-style element selectors are usually ok. But for component CSS classes are king. It's why BS4 styles naked <table> tags with reset styles, but offers the .table class as an option if you want the look and feel of their Table component.

BS has actually has an .h1 class. Eventually a design calls for an <h2> that needs to have the visual appearance of an h1 but for SEO or HTML semantics reasons needs to be an h2.

Maintaining any site of a certain size it spirals into a nightmare quite quickly. Look at how Bootstrap 4 can add a dropdown to a <div> or a <nav>. If your rule was just `nav {}` you wouldn't have that portability, `.dropdown` is clearly superior. On sites of scale modular CSS wins every time.

>It's not Bootstrap. Different paradigm.

Could have fooled me as a lot of the class names and styling are identical. If the m-* and p-* spacing utilities are identical, is it really a different paradigm? BS has (Sass) variables as well.

Re:Shoelace.css – A back to the basics CSS starter kit by claviska on Tuesday August 01, 2017 @12:01PM (#14902134)
This is certainly true for components, and Shoelace does style components this way (look at switches and tabs, for example). But for basic elements (non-components) IMO a clean reset is reasonable to expect.
Re:Shoelace.css – A back to the basics CSS starter kit by SippinLean on Tuesday August 01, 2017 @12:06PM (#14902202)
Agreed, it's inconsistent. What if I want a <table> without borders?

Should I expect an <a> with `.text-success` to overwrite `.tab-group a`? Or do I need a new class for `.tab-group .text-success`?

Look at how BS4 broke up Navs from being `.navbar > li > a` to being .navbar, .navbar-item and .navbar-link and think about why they did.

Re:Shoelace.css – A back to the basics CSS starter kit by claviska on Tuesday August 01, 2017 @02:10PM (#14903599)
Definitely some good arguments. Nothing is perfect, of course, and I'm always open to feedback like this.

In the meantime, a borderless table could be a modifier: table-borderless (i.e. like table-striped or table-bordered).

Just a different approach than what a lot of folks are used to :)

Re:Shoelace.css – A back to the basics CSS starter kit by shincert on Tuesday August 01, 2017 @10:28AM (#14900957)
How is it much easier to maintain?
Re:Shoelace.css – A back to the basics CSS starter kit by SippinLean on Tuesday August 01, 2017 @10:37AM (#14901054)
Because when everything is a class (even better, every selector is a single class like BEM strives for) overwriting rules is much easier because they all have the same specificity.

When you mix element selectors with class, ID, and multi-class (.foo.bar) selectors the specificity of each is different, and overwriting them means writing needlessly complicated selectors that are then in turn harder to maintain.

Bootstrap 4 goes as far as eliminating most sibling/child combinators (>, +, etc) because they add specificity. Anyone that's tried to write custom classes for list elements in Bootstrap 3 (.list-inline>li) has experienced this.

http://v4-alpha.getbootstrap.com/migration/#navs

Re:Shoelace.css – A back to the basics CSS starter kit by jessaustin on Tuesday August 01, 2017 @08:57AM (#14900146)
I think you're exactly right about this. The <tag class="tag"> idiom has always annoyed me.
Re:Shoelace.css – A back to the basics CSS starter kit by yellowapple on Tuesday August 01, 2017 @10:45AM (#14901148)
Personally, if I have to slap a bunch of classes on everything, then something is seriously wrong. HTML should be declarative, and it should be declarative of the content, not necessarily the presentation. Classes should therefore describe what something is, not how it's supposed to be presented. It's CSS' job to describe how it's supposed to be presented.

For that reason, I'll generally choose a <table>...</table> with a default style over having to do <table class="shoelaces-table">...</table> every time.

If you really do want to completely override the table style, it looks like it's just a matter of removing the respective line in https://github.com/claviska/shoelace-css/blob/master/dist/sh... and rebuilding.

Also, most modern browsers have a "developer" mode that shows exactly what CSS rules come from where. If the provided style really is getting in the way, it should be (relatively) easy to figure out what specifically is getting in the way (and then addressing it in your own CSS) instead of just blowing away the whole table style and starting from scratch. Looking at https://github.com/claviska/shoelace-css/blob/master/source/..., it doesn't look like it's doing all that much that'd be likely to conflict with anything in a way that would absolutely necessitate starting from scratch.

Re:Shoelace.css – A back to the basics CSS starter kit by SippinLean on Tuesday August 01, 2017 @10:57AM (#14901280)
>Classes should therefore describe what something is, not how it's supposed to be presented.

That's what we used to think when Semantic CSS was the big buzzword, lots of articles from '08-'11 preached it as the gospel. Turns out when a language is based on customizing presentation, presentation is semantic.

> I had a number of locations that I highlighted with a blue background and rounded corners. I called it `location` since it highlighted each of the locations

> When I opened the online store, I had a list of products and wanted to highlight each product using the same design pattern. Problem was, they weren’t locations. They were products. Being the lazy developer I was, though, I just reused the `location` class and applied it to my products. Clearly not ideal (but hey, it worked)!

> The design function was, of course, to highlight something. That was what I should’ve called it!

https://snook.ca/archives/html_and_css/semantic-css

Re:Shoelace.css – A back to the basics CSS starter kit by yellowapple on Tuesday August 01, 2017 @11:26AM (#14901692)
> Being the lazy developer I was, though, I just reused the `location` class and applied it to my products. Clearly not ideal (but hey, it worked)!

The new problem, though, is that in this case, if the developer wants to eventually use a different style for locations v. products, he'll now have to do the thing he was trying to avoid in the first place and have to create the new style.

If he stuck to letting HTML describe the content and CSS describe the presentation of that content, then when his tastes inevitably change, he'd just need to change one or the other class' styles in his CSS and call it a day.

This is even more relevant if you're using some kind of CSS preprocessor language (or whatever the term would be) like SASS/SCSS or LESS, since you can define that style as a mixin and apply it to each of the styles for specific content classes as you see fit.

Of course, what he did can still be compatible with HTML being content-declarative if you use a class like "important" or "special" or something; that way, you're still describing what the thing is without polluting HTML with presentation details. You can likely even mix that together ("important product" or "important location"), which would then pave the way for having unimportant products/locations.

> Turns out when a language is based on customizing presentation

Except HTML (especially HTML5) is not based on "customizing presentation". HTML is based on describing documents and the contents thereof. There were a few violations of that principle once upon a time (<b>, <i>, <u>, <blink>, <marquee>, etc.), but these are vestigial at worst (and outright eradicated at best), leaving a language that really is meant to declaratively describe content.

CSS is the language that is based on customizing presentation, and always has been (and hopefully always will be, though I can't wait for the day when CSS becomes Turing-complete).

Re:Shoelace.css – A back to the basics CSS starter kit by SippinLean on Tuesday August 01, 2017 @11:43AM (#14901926)
Nope, he just removes the `highlight` class.

>Except HTML (especially HTML5) is not based on "customizing presentation"

Right, I meant CSS, and the HTML classes you use to support it. h1.highlight is just as semantic as h1.

>CSS is the language that is based on customizing presentation

Right, so your CSS should be based on class names that point to their design function. Not "what something is".

Re:Shoelace.css – A back to the basics CSS starter kit by yellowapple on Wednesday August 02, 2017 @08:13AM (#14909855)
I think you have things backwards. CSS is meant to support HTML, not the other way around. Given that, the "CSS" class names (really HTML; classes have uses beyond stylesheets) absolutely should reflect "what something is".
Re:Shoelace.css – A back to the basics CSS starter kit by SippinLean on Wednesday August 02, 2017 @10:23AM (#14910768)
That's a overly broad statement that doesn't reflect the more specific one I made. Your HTML should be rock-solid and use semantic tags, regardless of CSS. The presentational classes you add to it are there, partly, to support your CSS.

>the "CSS" class names absolutely should reflect "what something is"

The example and article above goes to show exactly why that's wrong, if their function is design, they should reflect their design function. This is not theoretical, it is based on practice.

Re:Shoelace.css – A back to the basics CSS starter kit by yellowapple on Thursday August 03, 2017 @10:02AM (#14919619)
> The presentational classes you add to it are there, partly, to support your CSS.

Again: you have things backwards. Classes are there to describe what an HTML element is supposed to represent. CSS uses these to decide how that thing is to be displayed. JavaScript uses these to decide how that thing is to behave.

> The example and article above goes to show exactly why that's wrong

Except they don't, as I already explained.

> if their function is design, they should reflect their design function.

Yes, and the design function of an HTML element class is to describe what that element is. The fact that CSS is able to make use of them is a side effect of that.

If you really want to abuse HTML semantics, then go ahead; nobody's stopping you. Just don't pretend that it's the correct approach.

> This is not theoretical, it is based on practice

And the standard practice is a tangled mess of <div class="grid grid-3-7 highlight">. Doesn't mean the standard practice is actually good, or that there's no room for improvement.

Re:Shoelace.css – A back to the basics CSS starter kit by SippinLean on Friday August 04, 2017 @12:11PM (#14929751)
>CSS uses these to decide how that thing is to be displayed.

I already agreed with you: "they should reflect their design function"

You seem to be conflating semantic classes with presentational ones:

If all your articles have a blue border, maybe it makes sense to have .article have a border property. If your events, articles, and recipes all share the same Card format, it makes better since to keep those styles in .card.

>Except they don't, as I already explained.

You didn't explain; I said just remove the `highlight` class.

>Doesn't mean the standard practice is actually good, or that there's no room for improvement.

Not on its own, but the fact that this arose out of the maintenance nightmare that was "semantic CSS" from 5 years ago explains why it is now a best practice.

Re:Shoelace.css – A back to the basics CSS starter kit by ohitsdom on Tuesday August 01, 2017 @10:21AM (#14900882)
Agreed. Most of the time, it's great and leads for a cleaner DOM. But it could cause issues. A workaround I use in my own styles is doing something like class="plain", then the table rule would be table:not(.plain).
Re:Shoelace.css – A back to the basics CSS starter kit by appleflaxen on Thursday August 03, 2017 @05:49PM (#14924232)
that's a great trick! thanks for pointing it out.
Re:Shoelace.css – A back to the basics CSS starter kit by noway421 on Tuesday August 01, 2017 @07:36AM (#14899620)
Good point. Styling h1-h6 is good alongside the typography look and feel, but styling <table> without a class is misguided.