Angular 6 building a library with assets

后端 未结 5 1219
广开言路
广开言路 2020-12-07 21:25

Upon building & 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 dist/assets fold

5条回答
  •  时光说笑
    2020-12-07 21:54

    When you asked the question it wasn't able to include the css files on the dist folder unless you create a js script that handles the logic.

    Now it is possible because ng-packagr released a new version that allows you to include the assets along with the build files:

    You can copy these assets by using the assets option.

    {
      "ngPackage": {
        "assets": [
          "CHANGELOG.md",
          "./styles/**/*.theme.scss"
        ],
        "lib": {
          ...
        }
      }
    }
    

    More information here: https://github.com/ng-packagr/ng-packagr/blob/master/docs/copy-assets.md

提交回复
热议问题