Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Angular 7 how to specify folder for images in dist

When I build project by ng build command in dist folder I got my js files both with all other resources, but I want to move all images and fonts in separate folder like assets. Can anybody help me?

enter image description here

Update: angular.json "assets": [ "src/favicon.ico", "src/assets" ],

in scss of component I have:

background-image: url('assets/img/no-notifications.svg');

but in result I got in dist folder next file:

no-notifications.7e08682a570485d1c108.svg

Goal is keep image path same as he has been specified in scss file: assets/img/no-notifications.svg

like image 528
Svyatoslavik Avatar asked Dec 07 '18 10:12

Svyatoslavik


2 Answers

If you didn't already know, a new option was added into angular cli configuration (since v7.2.1) to copy css resources into another folder (relative to the output path).

"outputPath": "wwwroot",
"resourcesOutputPath": "images"

https://angular.io/cli/build

like image 187
Shino Avatar answered Sep 28 '22 07:09

Shino


try this

create img folder inside assets

and use path like ./assets/img/your_image

it will work.

like image 26
Bhargav Chudasama Avatar answered Sep 28 '22 07:09

Bhargav Chudasama