On Mon, Apr 23, 2012 at 2:46 PM, Ryan Kaldari <rkaldari(a)wikimedia.org>wrote;wrote:
I would like to second what Platonides has said.
It's important to
understand that 99% of the inline CSS comes from templates. Stripping the
CSS is probably not a good option, as the results would be rather
unpredictable (some of the templates are heavily dependent on CSS, some are
not). Unfortunately, there isn't currently a good solution to this, as the
way templates are constructed only allows for inline CSS (without spamming
Common.css). My preferred solution would be to start allowing <style> tags
within the Template namespace. Then people could create real CSS logic for
templates (including mobile styling with CSS queries). There is, however,
the slight problem that browser-makers and the W3C don't quite see
eye-to-eye on implementing <style> tags in the body. According to the W3C,
it is invalid to use <style> in the body unless it is scoped (i.e. uses the
scoped attribute). All current browser-makers, however, allow <style> in
the body and none of them support the scoped attribute. In other words, we
would be pretty much guaranteed to break our W3C validation for almost
every page, but as far as I can tell, this is already the case anyway.
I'd LOOOOOVE to use scoped <style>s, but as you note they're just not
supported yet.
It may make the most sense to have an extension (like the existing CSS
extension?) that lets you specify style blocks in a page or template, and
have it shove them into the header output for the page.
We'd need to make sure of a few things:
* appropriate scrubbing of script or url references
* make sure that we *do* ship the styles with pages for mobile....
* ... make sure that there's sane separation of base & large-screen styles ?
Potentially we can have something that's separate from @media queries but
lets us specify "don't use this style on mobile".
-- brion