>>! In T483#2209954, @TheDJ wrote:
> Some first practical experiences:
> 1: i quickly found a situation, where in lieu of inline styles, i'll have to use a unique (per parserrun) class or ID. we have no good options for this right now. For now, i'll keep using inline styles for those situations. (width specific to the image being transcluded)

There isn't a good option for this that I can think of.  Certainly, "new" best practices would be to avoid such parametrization entirely whenever at all possible since they play poorly with window width and mobile in all cases.  I expect most cases can be reduced to a smaller set of limited options, though (say, "auto, 75%, 100%").

At the very least, it then becomes possible to override such variation in a `@media` block with a `!important`; so the situation is "less bad" than it otherwise might have been.

> 2: the style block should probably be inserted AFTER the <meta name="ResourceLoaderDynamicStyles" content=""/>

The point of insertion is actually picked by core (in `OutputPage::addInlineStyle()`); we'd need to check whether that's the best spot in all contexts.

> 3: These style blocks will have to be exposed in the api, so that something like LivePreview can update them.
> 4: The style block will need an identifying attribute, so that something like livepreview can replace it.

I'm not familiar enough with LivePreview to evaluate what that entails.  I'll have to look into it.

> 5: Every conditional styling option of a template will require it's own class (always included). For instance, even if I don't use the border option of  http://ts.wmflabs.org/w/index.php/Template:Wide_image, I will always have to include the .noborder styling class. This might be more bytes and more unused styling classes for uses of certain templates.

I //expect// that's not a significant issue in practice; that duplication is probably offset by the fact that multiple inclusions of the same template cause the styles to be inlined only once and that using a class more than once within the same template removes the repetition of the inline style.

That said, it's theoretically possible to omit classes that are not in fact used on the page - the selectors for every rule are known at the point of insertion.  That would, however, require non-trivial parsing of the document and is probably best left to after we have determined that there is an issue to fix.