0

I'm having trouble setting up my angular-cli.json to copy the fonts and images directories from the @cmsgov directory within my node_modules.

One of the many errors I'm getting in my terminal is [/Users/user/WebstormProjects/angular-app/src/images/warning.svg] warning.svg doesn't exist. If needed I can provide more of the error code.

From looking at the documentation for angular-cli I should be able to copy the files using this line of code: { "glob": "**/*", "input": "../node_modules/some-package/images", "output": "./some-package/" }, but when I try to do this, I keep getting errors. I'm not sure what I'm doing wrong.

I'm currently using angular-cli version 1.4.9, and I can provide my complete package.json if needed

Here is my angular-cli.json file:

{
  "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
  "project": {
    "name": "angular-app"
  },
  "apps": [
    {
      "root": "src",
      "outDir": "dist",
      "assets": [
        "assets",
        "favicon.ico",
        { "glob": "**/*", "input": "../node_modules/@cmsgov/design-system-core/fonts", "output": "./assets/fonts" },
        { "glob": "**/*", "input": "../node_modules/@cmsgov/design-system-core/images", "output": "./assets/images" },
      ],
      "index": "index.html",
      "main": "main.ts",
      "polyfills": "polyfills.ts",
      "test": "test.ts",
      "tsconfig": "tsconfig.app.json",
      "testTsconfig": "tsconfig.spec.json",
      "prefix": "app",
      "styles": [
        "sass/styles.scss"
      ],
      "stylePreprocessorOptions": {
        "includePaths": [
          "../node_modules/"
        ]
      },
      "scripts": [],
      "environmentSource": "environments/environment.ts",
      "environments": {
        "dev": "environments/environment.ts",
        "prod": "environments/environment.prod.ts"
      }
    }
  ],
  "e2e": {
    "protractor": {
      "config": "./protractor.conf.js"
    }
  },
  "lint": [
    {
      "project": "src/tsconfig.app.json",
      "exclude": "**/node_modules/**"
    },
    {
      "project": "src/tsconfig.spec.json",
      "exclude": "**/node_modules/**"
    },
    {
      "project": "e2e/tsconfig.e2e.json",
      "exclude": "**/node_modules/**"
    }
  ],
  "test": {
    "karma": {
      "config": "./karma.conf.js"
    }
  },
  "defaults": {
    "styleExt": "scss",
    "component": {
    }
  }
}
1
  • Any success ? I am trying to copy the SVG files.. but no success... here is the snippet from angular.json build property: "assets":["src/favicon.ico","src/assets",{"glob": "*.svg","input": "../node_modules/material-design-icons/sprites/svg-sprite/","output": "assets/svg-icons"}] Commented Feb 11, 2019 at 7:11

1 Answer 1

1

It looks like your assets are copying correctly. To reference the files you should use the path assets/images/warning.svg

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.