[dojo-contributors] dojo.requireCss()?

Owen Williams owen at smartsoul.com
Tue Jun 12 14:47:51 EDT 2007

On Jun 12, 2007, at 11:16 AM, James Burke wrote:
> So to address the async loading issue with stylesheets as well as the
> path abstraction, I'm wondering if we can support something like
> dojo.requireCss(). It would resolve paths like dojo.require() does
> today and also treat the CSS as a resource that needs to be loaded
> before firing the domcontentloaded/onload callbacks. Example:
> dojo.requireCss("dijit.themes.dijit");
> which would map to dijit/themes/dijit.css. dojo.requireCss would pull
> in the CSS contents, fix the css paths and inline the CSS via
> something like the old insertCssText. It could process @import calls
> to files that mapped to module-prefixed paths too.

I think this is a great idea.

I have been privately circulating a similar idea to make themes  
easier to load, more flexible, and able to be managed by the build  
system.  I'll send a separate proposal for that if folks think that  
requireCss() is a good idea.

> The icing on the cake: specifying an i18n bundle in a CSS comment that
> should be loaded and allow token replacement with bundle values in the
> CSS. This step could maybe be an optional add-on (since it depends on
> i18n and string replacement code), but something I could have used
> before.

We do this sort of thing at Zimbra and it makes a lot of stuff  
possible in CSS that there is no other way to do.  James, I'd love to  
hear more about your thoughts on how this would work.


More information about the dojo-contributors mailing list