|
|
|
|
|
by lmm
4961 days ago
|
|
I know it's not a class in CSS terms, I didn't think that distinction was relevant. >No one expects a layperson to read or edit HTML, but they do have to receive it in some manner and your method is the most bloated way to do so. Sending things over the wire in compressed form is trivial (many servers do it already) so this doesn't bother me. >Why can't your magical application just output proper HTML and CSS, with external files if need be, without you ever having to deal with it? My goal here is to reduce the number of layers you need to understand to debug your webapp. Fundamentally CSS selectors provide a way to reuse (some small specific parts of) your markup in several places - but any web application framework will already provide a way to reuse markup, with its own logic. So why should developers have to learn two different ways of abstracting their markup? |
|
Yes, indeed, many servers send the HTML, CSS, and JS files compressed and is trivial, but bloated code that is compressed still takes more bandwidth than more efficient code compressed. There might be something said about combining all three into one HTTP request but to say that there's little difference between bloated inline styles and a properly created style sheet is an odd one. Even if the difference between the two is 10k per page then it adds up over time. It would be far better to rely on CSS classes in the head section of the document than to have duplicated inline styles throughout the document. It seems you are willing to create inefficient output for the sake of attempting efficient input, which only benefits you personally as the coder during the creation process of the project.
Therefore I don't think you are reducing the number of layers involved, but only masking it. In the end you will still have HTML and CSS but with a slightly different way to code them. If that's the extent of the goal then congratulations on duplicating what we already have. Although these applications are interesting and have intriguing ideas, they don't fundamentally address the inherent problems of HTML and CSS. For things like this all your doing is creating a new way to write inline styles which can be done right now without adding in new inherent problems.
What's the difference between this:
STYLE.on("element", {textAlign: "center", fontSize: 50})
or this:
element style="text-align: center; font-size: 50px;"
or this: .element {text-align: center; font-size: 50px;}
Almost nothing, in terms of inline styles. Except that the first two have to be duplicated throughout the code wherever they are required while the third only requires a reference. Now, if you need to change that text-align to left you have to change every instance of it throughout your code, except for the third where it only needs to be changed once. If this code is duplicated in multiple files then you've added complexity to the task, while with a single style sheet you only change one line. Also keep in mind that with the first example that code has to parsed on every single page load before it can be rendered.
Now, in the cases of small webapps I can see these things being of little concern. But for large projects or a regular website it's asking for headaches. Not because of things like domo, but because the end result has to be what the browser expects. Plus, there's the issue that if you want this web page to be indexed by search engines you're going to have problems. If people have turned javascript off or use a white list to control scripts then this page simply will not work with very little available fallback. If someone other than you needs to maintain or update this code and don't know this system then you will have problems.
So, am I saying that people should stop making these type of things and stop experimenting? Of course not, this type of exercise is interesting if the end goal is to determine how we could possibly replace HTML/CSS with something more useful in terms of modern websites and apps. For instance, being able to do mixins and the like in CSS is incredibly useful, which is why the CSS processors are popular. But to say that we can take something like domo to be used today as a replacement to HTML/CSS is a bit misguided. In the end it is still HTML/CSS, what we have here is the equivalent of a WYSIWYG editor for javascript coders who, for whatever reason, don't/can't/won't learn HTML and CSS even though those are the easiest parts of the equation.
Keep in mind this thread started for me because of your statement that CSS is not powerful enough to express styling when that's exactly what it does and all that it does. In the end I fail to see how what you propose is better than what we have today, in fact I feel it is worse.
By the way, CSS selectors do not provide a way to reuse your markup in several places. That is, if you are referring to HTML when you say markup, which is the usual definition of the word. CSS selectors let you target elements in your markup to style them, nothing else. You can use these selectors to reuse your CSS stylings for duplicate elements that require the same styling. It is statements like that suggest to me you don't fully understand the relationship between HTML and CSS.