Include Shared Assets In Angular
Asked Answered
I

1

5

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.

Insurer answered 24/1, 2019 at 20:53 Comment(0)
S
11

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"
    }
  ]
Stites answered 6/11, 2019 at 23:10 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.