title: Angular 6 building a library with assets
body: <p>Upon building &amp; packaging an Angular 6 library, I can't seem to be able to instruct the Angular CLI to copy the library's assets into the <code>dist/assets</code> folder on every build.</p>
  
  <p>Assuming the project's folder structure is this - </p>
  
  <pre><code>- dist
  - e2e
  - node_modules
  - projects
    - lib1
      - src
        - lib
        - assets
          - icons
  - src
  </code></pre>
  
  <p>When I run <code>ng build lib1</code> or <code>ng build lib1 --prod</code> the <code>assets/icons</code> folder is not being copied into <code>dist/lib1/assets/icons</code>. </p>
  
  <p>If I run <code>ng build</code> then <code>src/assets</code> (the root src/assets) is being copied but not <code>projects/lib1/assets</code>.</p>
  
  <p>The <code>angular.json</code> file contains a reference to <code>"assets": ["src/assets"]</code> but it won't allow adding the <code>assets</code> key specifically to the project, only to the main root app. When adding, I get the following error:</p>
  
  <blockquote>
    <p>Schema validation failed with the following errors:   Data path ""
    should NOT have additional properties(assets).</p>
  </blockquote>
  
  <p>I also tried adding the following custom copy rule to the assets to copy the assets to dist/lib instead of to dist/appname:</p>
  
  <pre><code>  "assets": [
       "src/favicon.ico",
       "src/assets",
       { "glob": "**/*", "input": "src/assets/icons", "output": "../lib1/assets/icons" }
          ],
  </code></pre>
  
  <p>But I get the following error:</p>
  
  <blockquote>
    <p>An asset cannot be written to a location outside of the output path.</p>
  </blockquote>
  
  <p>Is there a built-in way of managing library asset's copy on every build?</p>
  
  <p><strong>UPDATE 06/05/2018</strong></p>
  
  <p>I opened an issue with Angular CLI regarding this but have not heard back yet. <a href="https://github.com/angular/angular-cli/issues/11071" rel="noreferrer">Issue #11701</a></p>