question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Extended ng-packagr builder supporting assets

See original GitHub issue

Is your feature request related to a problem? Please describe. Angular CLI, or more specifically ng-packagr currently does not support bundling assets with libraries.

Corresponding issue in Angular CLI: https://github.com/angular/angular-cli/issues/11071

Describe the solution you’d like We could extend the official ng-packagr builder to copy the assets. This should be quite simple.

In addition devs would have to of course configure application assets in angular.json to copy the library assets so they are accessible during the runtime of the application.

Additional context I would love to create a PR with this new builder, since I already have it and I think it makes sense not to create a new package, but rather contribute here.

https://github.com/angular/angular-cli/issues/11071#issuecomment-531467088

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:3
  • Comments:17 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
just-jebcommented, Nov 12, 2019

I think it’s a great idea. Technically it should be pretty easy. We just need @linnenschmidt consent )))

2reactions
klemenoslajcommented, Mar 13, 2020

@klemenoslaj I don’t believe assets copying works in libraries…

Please check the link I provided again.

{
  "ngPackage": {
    "assets": [ <-------- HERE
      "CHANGELOG.md",
      "./styles/**/*.theme.scss"
    ],
    "lib": {
      ...
    }
  }
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

Angular Library copy assets not working ng-packagr
The command ng build @my-scope/my-library copies my assets folder (and all of its contents) to the dist/my-scope/my-library folder.
Read more >
ng-packagr - npm
Compile and package Angular libraries in Angular Package Format (APF). Latest version: 15.0.1, last published: 10 days ago.
Read more >
Assets support for Angular 7 Library - Clairvoyant Blog
Assets support for Angular 7 Library. If you are building libraries in Angular and want to supply assets from the library package, here's...
Read more >
Creating libraries - Angular
Angular CLI uses a tool called ng-packagr to create packages from your ... For more information copy assets into your library as part...
Read more >
A complete guide to Angular libraries - Will Taylor Blog
2) Alternatively, include your fonts and images in an assets folder within the library. As the `ng-packagr` build process will not copy your ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found