HTML is for hypertext documents, and CSS an organ of the same organism called 'HTML/CSS'. It's made for text documents, and applying it to the implementation of GUI-centric applications has always been an ugly hack. For awhile (90s to 00s AJAX) it was necessary, and now the whole professional ecosystem has built up tremendous inertia over the millions of accumulated people/hours of perfecting this 'competency'/hack.…
CSS Modules
51–60 of 93 posts
Re: CSS Modules
#52Re: CSS Modules
#53Earlier quoted context omitted.
Not sure why you're getting downvoted. Problems with CSS at Scale are very real (as mentioned in the slide). But this is a super complicated solution. Its like one of the head-over-heels approaches in JoelOnSoftware blogs. Surely there has to be a simpler way. Its good that the authors are trying. But just look at the picture on this article captioned "This is how intensely we’ve been thinking about CSS". That's wher…
> Not sure why you're getting downvoted. Because it doesn't contribute anything but nonconstructive criticism. > Good solutions present themselves and fit naturally. Complex problems require complex solutions. Also, what's so complex and non-fitting about this solution? Explaining that (and your alternative solution) would be much better than simply criticizing as you and GP did. > Surely there has to be a simpler wa…
No, it's just an opinion and a comment on the sensationalistic article (sub)title.
Re: CSS Modules
#54It feels to me that this conversation is quite old I'm finding myself not convinced by the examples put forward in the article. It looks like a lot of unnecessary complexity. You can have a lot of success by simply picking a common css convention. .mybutton /* all styles for Normal */ .mybutton.disabled /* overrides for Disabled */ .mybutton.error /* overrides for Error */ .mybutton.in-progress /* overrides for In Pr…
Re: CSS Modules
#55It feels to me that this conversation is quite old I'm finding myself not convinced by the examples put forward in the article. It looks like a lot of unnecessary complexity. You can have a lot of success by simply picking a common css convention. .mybutton /* all styles for Normal */ .mybutton.disabled /* overrides for Disabled */ .mybutton.error /* overrides for Error */ .mybutton.in-progress /* overrides for In Pr…
Now what if you wanted to bring in another button - a very similar one - with slightly different styles?
.mybutton
/* all styles for Normal */
.mybutton.skewed
/* overrides for Skewed */
.mybutton.disabled
/* overrides for Disabled */
class="mybutton skewed disabled"
The suggestion in the OP would be that each one of those classes contain all of the styles for the button. That isn't necessary. Plus it requires, what I count, a minimum of two additional language abstractions in order to do it.Re: CSS Modules
#56Surely not the future.
Not sure why you're getting downvoted. Problems with CSS at Scale are very real (as mentioned in the slide). But this is a super complicated solution. Its like one of the head-over-heels approaches in JoelOnSoftware blogs. Surely there has to be a simpler way. Its good that the authors are trying. But just look at the picture on this article captioned "This is how intensely we’ve been thinking about CSS". That's wher…
Re: CSS Modules
#57The advantage of BEM naming is that it takes 0 effort to find your style definitions in code. .Button--disabled copied in the browser, will find exactly 1 definition in the project. .components_submit_button__normal__abc5436 will not find you anything.
Re: CSS Modules
#58Earlier quoted context omitted.
But on the flipside, in the latter case, you don't even need to grep for it -- "components_submit_button__normal__abc5436" reads as "components_{filename}_{classname}...", so you know right away to go look in "submit_button.(css|less|etc)" for ".normal {...".
This is certainly a less convenient approach. You always need to parse the class name in your head to open the correct file.
And, yes I understand that you can have grep output a path name and pass that directly in as an argument to your text editor. Similarly, it'd be relatively trivial to write a bash function that'd parse the class name and find the correct file to open.
Something like:
function lookupcss() {
find . | grep $(expr "$1" : '\(.*\)__.*' | sed 's/_/.*/g')".*\.css$";
}Re: CSS Modules
#59This seems like too much abstraction (magic) of things. Plus those auto generated classes really look odd and would make debugging difficult.
loaders: [
...
{
test: /\.css$/,
loader: 'css?localIdentName=[name]__[local]___[hash:base64:5]'
}
]Re: CSS Modules
#60"The composes keyword says that .normal includes all the styles from .common" -- great, except you have the meaning of the word reversed. In the context above it actually means ".normal is part of .common", which is clearly not the intent. If you wanted it to mean that ".normal includes all the styles from .common" then .normal should be "composedOf: common"
Correct. Would the word 'comprises' be more appropriate?