Angular-cli: Where to add Images and other files in 1.0.0-beta.14

Created on 15 Sep 2016  路  3Comments  路  Source: angular/angular-cli

  1. OS? Windows 7, 8 or 10. Linux (which distribution). Mac OSX (Yosemite? El Capitan?)
    Windows 10
  2. Versions. Please run ng --version. If there's nothing outputted, please run
    in a Terminal: node --version and paste the result here:
    angular-cli: 1.0.0-beta.14
    node: 6.5.0
    os: win32 x64
  3. Repro steps. Was this an app that wasn't created using the CLI? What change did you
    do on your code? etc.
    ng new Angu2Final.

I read online that in project we have public folder but when I pulled the code there was not public folder and when I did ng build I was not able to see my images .


Thanks! We'll be in touch soon.

Most helpful comment

See the property 'assets' in angular-cli.json.
This means images (or assets in general) have to be placed under _root/assets_, in this case it will be under src/assets.

"apps": [
    {
      "root": "src",
      "outDir": "dist",
      "assets": "assets",
      "index": "index.html",
      "main": "main.ts",
      "test": "test.ts",
      "tsconfig": "tsconfig.json",
      "prefix": "app",
      "mobile": false,
      "styles": [
        "styles.css"
      ],
      "scripts": [],
      "environments": {
        "source": "environments/environment.ts",
        "dev": "environments/environment.ts",
        "prod": "environments/environment.prod.ts"
      }
    }

All 3 comments

See the property 'assets' in angular-cli.json.
This means images (or assets in general) have to be placed under _root/assets_, in this case it will be under src/assets.

"apps": [
    {
      "root": "src",
      "outDir": "dist",
      "assets": "assets",
      "index": "index.html",
      "main": "main.ts",
      "test": "test.ts",
      "tsconfig": "tsconfig.json",
      "prefix": "app",
      "mobile": false,
      "styles": [
        "styles.css"
      ],
      "scripts": [],
      "environments": {
        "source": "environments/environment.ts",
        "dev": "environments/environment.ts",
        "prod": "environments/environment.prod.ts"
      }
    }

Okay, so... It's copying /src/assets/images to /dist/assets/images, but it's not copying all files. In my case, it copies the four .png files, and leaves the one .jpg file sitting there.

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

_This action has been performed automatically by a bot._

Was this page helpful?
0 / 5 - 0 ratings