Filipe Silva 41c864956e docs: add lazy scripts/styles docs
This was added back in #3401 but never documented.

Also cleans up duplicate docs in overview.

Close #4693
2017-02-15 12:24:27 +00:00

581 B

Global styles

You can add Javascript files to the global scope via the apps[0].scripts property in angular-cli.json. These will be loaded exactly as if you had added them in a <script> tag inside index.html.

This is especially useful for legacy libraries or analytic snippets.

"scripts": [
  "global-script.js",
],

You can also rename the output and lazy load it by using the object format:

"scripts": [
  "global-script.js",
  { "input": "lazy-script.js", "lazy": true },
  { "input": "pre-rename-script.js", "output": "renamed-script" },
],