-
Notifications
You must be signed in to change notification settings - Fork 12k
Support inlining of css and html resources #296
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
This is indeed needed. Currently I like many others use webpack to |
Hm, though cookie. Perhaps this should be part of the bundling functionality. Also cc @cironunes who was working on prod builds. |
this should be prod build only anyway. Assigning to @cironunes to fix. |
Inline templates via "--inline-template" or "-it" Inline steyles via "--inline-style" or "-is" Fixes angular#296 Fixes angular#349
Inline templates via "--inline-template" or "-it" Inline steyles via "--inline-style" or "-is" Fixes angular#296 Fixes angular#349
Inline templates via "--inline-template" or "-it" Inline styles via "--inline-style" or "-is" Fixes angular#296 Fixes angular#349
@Brocco your PR looks like it's just for generating components. This issue was about inlining the contents of separate files at build time. |
@jelbourn you are correct, I apologize. This will be handled when the idea of offline template compilation gets added the CLI. |
Related to this, when developing locally and using |
@randyaa use moduleId in your Component decorator: import {Component} from '@angular/core';
@Component({
moduleId: module.id,
selector: 'awesome-component',
templateUrl: 'awesome.component.html',
styleUrls: ['awesome.component.css']
})
export class AwesomeComponent {} |
any update on this? would be nice to see soon. |
@filipesilva Is this the issue to follow for offline template compiler and tree shaking to get build sizes shown at ng-conf or is there a better one to follow? |
This one also seems to be closely related. angular/angular#6612 |
This is a completely different issue than offline-compiler support (which resides in angular/angular). Inline resources is something that would be done for Angular component libraries which are then consumed into application and compiled as one unit. |
@jimitndiaye would you have more info on how to implement webpack with Angular CLI so I can |
@ghpabs I only use angular-cli for the scaffolding (ng generate...). So I only added the minimum necessary to get that to work. The project is based on angular2 webpack starter with minimum config added to enable angular-cli to work. |
Inlining of CSS and HTML added in #1455. |
How can I configure it? |
@madaraszistvan it happens automatically, there is no configuration for it. Are you having problems with it? |
I see, the css and html is in the |
@filipesilva By support for inline templates, we are asking for an option that triggers a transformation layer before compilation. Namely a layer that will turn all The lack of this tooling is the primary reason why this library: https://www.npmjs.com/package/gulp-inline-ng2-template is getting ~30,000 downloads a month. It is the only sensible way to prepare an angular2 package to be properly pulled in from npm (relative paths fail!) |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
The CLI should support swapping out
templateUrl
andstyleUrls
with the inlinedtemplate
andstyles
, respectively. This will facilitate the publishing of components (such as material2).There is currently a gulp plugin that does this already. The actual inlining logic is all contained in one module while the gulp-specific parts are in another.
The inlining needs to at least occur after other build steps run for any tools that may output css or html. The material2 source, for example, uses scss to generate the css files that should be inlined into the components.
The pending Angular offline template compiler actually won't cover this use case, as the person running the template compiler is the end application, not the component library.
cc @hansl
The text was updated successfully, but these errors were encountered: