blazehub
blazehub

Reputation: 1960

Include Shared Assets In Angular

I have create a angular workspace which host multiple angular projects and libraries.

In workspace I have a shared library which contains all assets(images and logos).

"assets": [
              "projects/xxx-workspace/src/favicon.ico",
              "projects/xxx-workspace/src/assets",
              "projects/xxx-shared/src/lib/images"
          ]

"projects/xxx-shared/src/lib/images"

But while building the application it throws error:-

asset path must start with the project source root.

What is the expected configuration to achieve this.

Upvotes: 5

Views: 3832

Answers (1)

JoAMoS
JoAMoS

Reputation: 1529

Hope you got this figured out. There is a cookbook article about this on nrwl connect https://connect.nrwl.io/app/cookbook/3lUhYk6aXO4kiKqfTfj3fs. In short, angular cli doesn't let you reference assets outside the project source in that syntax, so to do this you can use this syntax https://angular.io/guide/workspace-config#assets-configuration

  "assets": [
    {
      "input": "libs/my-lib/src/lib/assets",
      "glob": "*.png",
      "output": "assets"
    }
  ]

Upvotes: 12

Related Questions