[Cosmo-dev] Re: [commits-cosmo] (mde)
[2934] Fixed dueling-stylesheets
issue in login page, removed old Cosmo Ui boilerplating.
Matthew Eernisse
mde at osafoundation.org
Thu Nov 30 13:10:28 PST 2006
Travis Vachon wrote:
> Given this description, it sounds like including other stylesheets on
> the page causes problems. Doesn't this defeat some of the purpose of
> CSS, that is, to be able to provide page specific stylesheets as well as
> global stylesheets?
>
> Using your styler code, what would be the appropriate strategy for using
> an "admin console" specific plain CSS stylesheet on admin pages?
Sorry, I should have been a little clearer. When the code was originally
written, it assumed that all stylesheets on the page were being added
dynamically -- i.e., that the dynamic CSS code had sole control of the
styles on the page. It was not originally intended to work with
pre-existing, static CSS files.
I committed a change a couple of days ago that fixes that behavior, so
that it plays nicely with others -- it appends the new stylesheet to the
document head and inserts the dynamically generated rules into that sheet.
Now the only issue you'll have is the normal CSS issue of making sure
you don't create conflicts in the styles you define (e.g., by defining
two different rules with the exact same selector in two different files).
As a side note, I originally designed the dynamic CSS code to work with
multiple dynamically-created stylesheets. The other styles you use don't
necessarily have to be static.
And of course since we have programmatic control of the styles, it's
also reasonable to think about things like lazy-loading of needed
styles, even for a 'single-page app' component. For example, you could
load the CSS for the table view in the background once the user gets the
default calendar view.
Matthew
More information about the cosmo-dev
mailing list