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.

Support inlining of css and html resources

See original GitHub issue

The CLI should support swapping out templateUrl and styleUrls with the inlined template and styles, 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

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Reactions:8
  • Comments:19 (9 by maintainers)

github_iconTop GitHub Comments

2reactions
jimitndiayecommented, Jul 1, 2016

@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. That webpack template allows in-lining html, css, etc.

1reaction
justindujardincommented, May 10, 2016

@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 {}
Read more comments on GitHub >

github_iconTop Results From Across the Web

Improve site performance by inlining your CSS - LogRocket Blog
One of the ways you can improve the performance of your site is by inlining your CSS. This article explains the “what” and...
Read more >
Inline Small Resources | PageSpeed Service
Reduce round trip time by inlining CSS, JS and images in the HTML. PageSpeed rule. This rewriter implements the PageSpeed rules for minimizing ......
Read more >
Inline Small CSS and JavaScript - KeyCDN Support
Inline small CSS and JavaScript can be beneficial to help reduce load times since less round trips need to be made to fetch...
Read more >
Handling common HTML and CSS problems - MDN Web Docs
This includes linting code, handling CSS prefixes, using browser dev tools to track down problems, using polyfills to add support into browsers, ...
Read more >
A Guide to CSS Inlining in Email - Litmus
Inline styles are applied directly to HTML elements in each line of HTML—and are generally the safest way to ensure rendering compatibility ......
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