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
Post a Comment