This question is similar but different to this question. For example my normal components include CSS files through webpack styles: [ require("./search.styles") ]
where search.styles.css is the style file. Now I have an attribute directive, lets call it expandable search. It has a lot of transitions and styling, this makes setting each style programmatically tedious.
Is there a way to just include the entire CSS file somewhere in the directive?
Update
So to describe the differences, say I have the following template for the component that the attribute directive is used on...
<my-component myDirective>
<div class="div1"></div>
<div class="div2"></div>
...
</my-component>
If I wanted to say set a background color on each one with the directive (of course in my real world this isn't that simple and style properties needed vary so iteration doesn't really work). If I were using host binding I would have declare a @HostBinding
for each element and then maintain each style through code. This would be a lot of work and I would like to avoid it.