Add ngc option to inline templates for libraries.
See original GitHub issueI’m submitting a … (check one with “x”)
[ ] bug report => search github for a similar issue or PR before submitting
[x] feature request
[ ] support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question
Current behavior
Angular library authors should inline templates (html/css) to ensure overall compatibility between different consumer types.
This can be done with a fairly simple script, but it has a few pitfalls:
- special care must be taken to maintain sourcemap lines (inline over TS sources before
ngc). - unit testing requires a separate module.id based setup to load templates into karma.
- no watch mode.
Expected behavior
Since inlining is heavily encouraged for library AOT compilation, it should be included as an option for ngc (e.g. angularCompilerOptions.inlineTemplates).
Minimal reproduction of the problem with instructions An example library can be found at https://github.com/filipesilva/angular-quickstart-lib.
What is the motivation / use case for changing the behavior? Less work for everyone building and shipping components, one less point of failure.
-
Angular version: 4.x
-
Language: [ TypeScript 2.x ]
/cc @IgorMinar @jasonaden
Issue Analytics
- State:
- Created 6 years ago
- Reactions:15
- Comments:14 (11 by maintainers)

Top Related StackOverflow Question
done via https://github.com/angular/angular/commit/b5be18f4059dc09ee9a3eb22ebd0b1485262e8fa
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.