How to use SASS to factor out :host in CSS? -


i have sass code

:host {      padding:10px; } :host(.headroom) {     position: fixed; } 

but how can turn like

:host {      padding:10px;     &(.headroom) {         position: fixed;     } } 

sass complains syntax error if that.

(.headroom) not valid selector on own. either go unnested variant or make use of @at-root directive:

:host {      padding:10px;      @at-root #{&}(.headroom) {       position: fixed;     } } 

which outputs:

:host {   padding: 10px; } :host(.headroom) {   position: fixed; } 

Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -