Friday, 22 March 2019

How to bundle asset for angular application that is loaded elsewhere

For an Angular 7 application that finally build to

- main.js
- assets
  -- assets/img

With an component/html that reference to asset as

src='./assets/img/img1.jpeg'

The application would be given to different teams and can be hosted on different roots

example.com/route/first
example2.com/route/second

If the consumer refer to my build content as <script src=''../some-dir/libs/main.js">

The Angular application will look at the current path to find assets ( example.com/route/first/assets )

How can I correctly build/bundle/reference assets that the consumer can use anywhere by just extracting and referencing/importing my build content ? ( That I don't need to know consumer's project structure and the consumer does not need to alter my/his folder structure )



from How to bundle asset for angular application that is loaded elsewhere

No comments:

Post a Comment