faceless2 · GitHub

This is following on from a brief conversation with @tabatkins at CSSDay.

While I like the scoping proposal, I think it really needs a way to scope styles from an imported stylesheet. As it is now you can define your scopes - great for modularization - but the rules have to be inline in the same sheet, which seems to defeat the purpose a bit to me.

There are several ways to do this - an @import inside a @scope is one, but I think for consistency with cascade layers the syntax should be like

@import uri(module.css) scope(.media-object) to (.content);

Also useful but slightly more controversial (it doesn't have the desired behaviour when the attribute is not recognised) would be adding a scope and (pending a better idea) a scope-to attribute to <link>, the same way that it now has layer (see whatwg/html#7658)

<link rel="stylesheet" href="module.css" scope=".media-object" scope-to=".content">

Read the original on github.com ↗