Reputation: 934
Is there a way to include assets in an Angular Library, using the latest version of Angular? I've read some variants, but the answers were for Angular 6 and since then the CLI has improved.
Upvotes: 0
Views: 106
Reputation: 1930
Yes, now it's possible.
A few days ago, ng-packagr released a new version that allows you to include the assets along with the build files:
You can copy these assets by using the assets option.
{
"ngPackage": {
"assets": [
"CHANGELOG.md",
"./styles/**/*.theme.scss"
],
"lib": {
...
}
}
}
More information here: https://github.com/ng-packagr/ng-packagr/blob/master/docs/copy-assets.md
In resume, if you follow the Angular Documentation on how create a Library and you include the new ng-packagr configuration, you will be able to include the css files in the build.
Upvotes: 1