Reputation: 11816
We need to create a pure CSS library that can be used by our Angular, React, Vue and WC applications and libraries. Something that can be accessed in a way like @myorg/styles.
It seems related to this ticket #54 but it's already Closed with a promise that something will be done to address it.
However, I still can't see a proper way (via plugin?) to do this. I'm curious how others create a shareable (framework-agnostic) styles library.
Upvotes: 4
Views: 4040
Reputation: 3095
Simply generate a library via nx generate library
and reference that library in your apps. docs
Generator will generate a complete library template (ts + css) but you can clean generated code with your needs.
Upvotes: 2
Reputation: 340
Your question is interesting. However, I think it may be impossible because we know that Angular (example) are javascript-base with layers to encapsulate:
App -> Modules -> Components -> TS + style + html
So it's hard to make the impact from a library directly to Component style
.
A solution I can think of is instead of a library so we can create a folder called styles
to store scss/sass files and import them separately to component files or angular.json. It's so basic and not cool, but it should work.
Or if I were you, I would probably want to push these style files to a CDN storage (private/public) and add the <link rel="stylesheet" />
to index.html.
Hope this help particularly!
Upvotes: 0