Live data from Hacker News

JSON stylesheets - screw CSS frameworks, use JavaScript - JSSS

maraksquires.com

21–30 of 36 posts

Re: JSON stylesheets - screw CSS frameworks, use JavaScript - JSSS

#21

Earlier quoted context omitted.

1. jQuery and sizzle are pretty fucking fast 2. if you cant separate your business logic from your views....you have bigger problems to deal with....

1. Not as fast as C++ 2. Exactly. And this simply invites someone to put in the stylesheet. 3. Debugging CSS is already not trivial due to implementation issues. As this technique still relies on CSS you will still have some of the same issues. 4. Ability to have expressions in the stylesheets has already been tried. Once. Trust me you don't want it. Testing and debugging it is very hard.

lolwut?

i'll agree with you that c++ is faster then jQuery....good day

Re: JSON stylesheets - screw CSS frameworks, use JavaScript - JSSS

#22
post #4

Earlier quoted context omitted.

as the article states, "CSS frameworks (haml, sass, less) are meant for server-side templating and we need client-side templating." this is intended for client-side templating and dynamically assigning CSS classes and properties at run-time. :-)

That reasoning is kind of circular, isn't it? Why do you need client-side stylesheet dynamism?

So you can allow styles to update without a page reload?

For example, on Mibbit, you can skin your client how you like. You just open a prefs screen and mess with colors, fonts, backgrounds, etc.

Using css for that would be ridiculous. Hence client side styling via js.

Re: JSON stylesheets - screw CSS frameworks, use JavaScript - JSSS

#23

Earlier quoted context omitted.

if used in conjunction with a traditional CSS framework and you require javascript for your page, there are really no dis-advantages. in my rich internet applications i will use traditional CSS for the initial "base" state of the application and then JSSS for all further states which are generated via JS (no page-reload)

in my rich internet applications i will use traditional CSS for the initial "base" state of the application and then JSSS for all further states which are generated via JS (no page-reload) Why not just have the dynamic style in a separate class next to the base class it's applied to and then use jQuery.addClass?

you could implement a parser that used .addClass() and .removeClass() instead of .css()

if i release an official parser i think it would use those methods.

the whole point is to store your CSS in JSON and parse it with JS, the libraries used to do the parsing / assigning are kinda arbitrary.

Re: JSON stylesheets - screw CSS frameworks, use JavaScript - JSSS

#24
post #13
post #10

Earlier quoted context omitted.

"CSS frameworks work whether or not client disable Javascript." I've been thinking about this a lot lately and I'm not sure it's that big a concern anymore. I did a test one day and tried to get through a day with Javascript disabled and I came to the conclusion the web simply isn't usable that way. Because these days even the simple sites require Javascript because tools like dreamweaver embed javascript for menus a…

Until very recently, you were either all-in with Flash or you couldn't watch most video online. Now there's ClickToFlash. Similar things are happening with JS. Either way, it's a disadvantage of doing styles in pure JS.

And it's a disadvantage to using CSS if the user has disabled CSS :/ I'm not sure why that argument is relevant. Fact is, 99%+ will have CSS and JS enabled.

Re: JSON stylesheets - screw CSS frameworks, use JavaScript - JSSS

#25
post #15

> CSS is not a programming language - no variables, no functions, no logic How is that an issue and what made you think that it was a programming language? > CSS properties are not cross-browser compatible Neither is the DOM. Both statements are misleading because most CSS properties are cross-browser. > CSS frameworks (haml, sass, less) are meant for server-side templating and we need client-side templating This is…

i appreciate you took the time to read through everything and respond so throughly, but you seem to be missing the whole point. you can try re-reading the comments on this thread but if you've never dealt with really rich javascript apps, i can see why this is hard to grasp.

> i appreciate you took the time to read through everything and respond so throughly, but you seem to be missing the whole point.

You are right, I do not understand why I would want to place CSS inside an object literal instead of just placing the CSS in a CSS file.

>you can try re-reading the comments on this thread but if you've never dealt with really rich javascript apps, i can see why this is hard to grasp.

Ok, I see (not in any order):

1. "Here, something like this already exists, see [link]"

2. "This wont work / This will be slow / What is the point of this"

3. "Server-side preprocessing already works"

4. You refuting anyone who disagrees with you.

Re: JSON stylesheets - screw CSS frameworks, use JavaScript - JSSS

#26
post #10
post #2

(1) CSS frameworks work whether or not client disable Javascript. (2) Many of the problems this article's thesis lays out with CSS are solveable server-side, by preprocessing CSS.

"CSS frameworks work whether or not client disable Javascript." I've been thinking about this a lot lately and I'm not sure it's that big a concern anymore. I did a test one day and tried to get through a day with Javascript disabled and I came to the conclusion the web simply isn't usable that way. Because these days even the simple sites require Javascript because tools like dreamweaver embed javascript for menus a…

There's a good chunk of people using NoScript. By forcing people to use javascript, you're making the barrier of entry higher for those people.

Sometimes, when I see a page completely broken because it requires javascript, I just close the tab. If it's too much trouble to get your pages, which might only have static text or other elements that don't require anything fancy, to work without javascript, it's probably not worth my time to check out your page.

Re: JSON stylesheets - screw CSS frameworks, use JavaScript - JSSS

#27
post #25

Earlier quoted context omitted.

i appreciate you took the time to read through everything and respond so throughly, but you seem to be missing the whole point. you can try re-reading the comments on this thread but if you've never dealt with really rich javascript apps, i can see why this is hard to grasp.

> i appreciate you took the time to read through everything and respond so throughly, but you seem to be missing the whole point. You are right, I do not understand why I would want to place CSS inside an object literal instead of just placing the CSS in a CSS file. >you can try re-reading the comments on this thread but if you've never dealt with really rich javascript apps, i can see why this is hard to grasp. Ok,…

"Server-side preprocessing already works" != Rich javascript apps.

Re: JSON stylesheets - screw CSS frameworks, use JavaScript - JSSS

#28
post #24
post #13

Earlier quoted context omitted.

Until very recently, you were either all-in with Flash or you couldn't watch most video online. Now there's ClickToFlash. Similar things are happening with JS. Either way, it's a disadvantage of doing styles in pure JS.

And it's a disadvantage to using CSS if the user has disabled CSS :/ I'm not sure why that argument is relevant. Fact is, 99%+ will have CSS and JS enabled.

Sites still function without CSS. The same cant be said for poorly coded sites and javascript. I do agree this is mostly a non-issue though.

Re: JSON stylesheets - screw CSS frameworks, use JavaScript - JSSS

#29
post #25

Earlier quoted context omitted.

i appreciate you took the time to read through everything and respond so throughly, but you seem to be missing the whole point. you can try re-reading the comments on this thread but if you've never dealt with really rich javascript apps, i can see why this is hard to grasp.

> i appreciate you took the time to read through everything and respond so throughly, but you seem to be missing the whole point. You are right, I do not understand why I would want to place CSS inside an object literal instead of just placing the CSS in a CSS file. >you can try re-reading the comments on this thread but if you've never dealt with really rich javascript apps, i can see why this is hard to grasp. Ok,…

How would you load that CSS file dynamically into your DOM?

pretend you had 1,000,000 CSS classes that could be used in your one-page JavaScript application. you cannot load all of these with on page load.......too much data.....you'd have to start dynamically loading .css files using AJAX requests......and you realize that dynamically inserting a tag isn't cross-browser...so you try to parse the .css file in JS.....but then you realize that you have no way of natively parsing a .css file in JavaScript.....so you find / build a .css parser.....which is slow as balls.......then you want to start manipulating these classes and have no place to access them......so you have to store them in memory somewhere....might as well use nested JSON!

pretend you didnt know what your CSS classes were going to be until run-time.....like creating dynamic DOM views based on user input.....you would have to store your CSS properties in memory regardless....might as well use nested JSON!

pretend you had an entire javascript application stack and several tools for managing JSON documents on the server and the client.....

if i'm refuting people who disagree with me....this is not my fault. i am simply responding to peoples comments and questions. i'm always open to insightful suggestions and recommendations.....

edit: also i'd like mention your comment about line numbers is kinda silly.....i could just make it one line.....its JavaScript.

i said 4 lines since it was : function declaration, for loop, if conditional one liner, else conditional one liner.......

if you are really that upset about the line number count please let me know the correct amount of line numbers and i'll be sure to update my page

Post reply on HN