question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add ngc option to inline templates for libraries.

See original GitHub issue

I’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:closed
  • Created 6 years ago
  • Reactions:15
  • Comments:14 (11 by maintainers)

github_iconTop GitHub Comments

0reactions
angular-automatic-lock-bot[bot]commented, Sep 13, 2019

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Angular compiler options
The template options object, angularCompilerOptions , is a sibling to the compilerOptions object that supplies standard options to the TypeScript compiler.
Read more >
Create Angular 2 component library without inline styles
The problem here is that when you compile your npm package the styles templates must be inline because when you load it as...
Read more >
How to create AOT/JIT compatible Angular 4 library ... - Trekhleb
Having Gulp in the library's arsenal makes it possible to perform SCSS compilation in prior to templates inlining. Template inlining are done ...
Read more >
Set a custom template for a SharePoint library
Navigate to the site containing the library for which you want to specify a custom template. Option 1: (From Modern UX of the...
Read more >
Angular Library with ng-packagr - Medium
Since the library should be bundled all in once place, the first step should be to inline all the external templates.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found