« Return to Thread: A thought about CSS

A thought about CSS

by Maulin Shah, MD :: Rate this Message:

Reply to Author | View in Thread

Overall, i think the approach to CSS in dijits is fantastic. In fact, the whole concept of namespacing in CSS, and of using @import statements that can be inlined during a build is nothing short of revolutionary IMHO.

But I'd like to offer this observation:

There are really 2 kids of CSS for dijits -- "structural" and "theme". By that, I mean there is some amount of CSS that is necessary just to get the widget to work at all -- stuff like display, position, and all sorts of stuff. Then there is the stuff that makes dijits look nice - background images, fonts, and that kind of stuff.

I don't like the fact that the two are essentially munged together in many circumstances. Wouldn't it make sense to somehow inline all "structural" css right into the widget (perhaps along with templatePath we go back to templateCssPath that is somehow inlined into the widget during a build?). That way, using dijits could work out of the box without including a particular stylesheet or adding a class to the body tag. Then you add the stylesheet/body class to load the "theming" to make your widget pretty.

In my use of dojo, I generally develop sophisticated widgets, and then want other web developers to use them. I think the ideal case for me is to tell them "here, add this one line script tag to your page, and the rest will just work". Right now, I have to add at least several lines to each page.

I've gotten around this to some degree with "bootsrap" script that loads dojo, adds class to the body tag, and loads tundra css, then loads my widgets. But its not the best solution. In addition, when just playing with dojo, i'd say one of the most common reasons to think the whole thing is "just too complicated" is that you have to be sure you include the js, the style, and the body class to get it to work at all. Miss one step and often you fail without very good feedback. In the spirit of dojo.base and minified dojo to make the toolkit quick and easy to use (and I assume drive adoption to a slightly less savvy crowd), wouldn't it make sense to be sure everything "just works" when you add the dojo script and then do your dojo.requires?

just food for thought...

--
-maulin

_______________________________________________
FAQ: http://dojotoolkit.org/support/faq
Book: http://dojotoolkit.org/docs/book
Forums: http://dojotoolkit.org/forum
Dojo-interest@...
http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest

 « Return to Thread: A thought about CSS