

Internal css should not be display on view source
Please tell us about your environment:
Angular version: 5.0.1
Where do you think this styling should go? Keep in mind that the point of SSR is to provide the output generated by the server as quickly as possible, and having an external stylesheet delays this considerably.
I am using angular material in this project which append lots of css. My main concern is it may affect seo performance. I also had worked in angular 1 and material in that if you view source that appended css isn't visible. You can only see I inspect element.
If you really want to remove this, you can use the BEFORE_APP_SERIALIZED render hook, and then remove any <style> tags from the <head> in the injected DOCUMENT object.
@CaerusKaru can you help me out to use the BEFORE_APP_SERIALIZED render hook to ramove style tag.
Close this issue, since this is clearly not a problem with Angular Universal. Use Stack Overflow for support requests, and you can link the SO question here so I can take a closer look at it.
@Anil24 did you find a solution to this?
Yes.
Would you mind to share it?
At location node_modules\@angular\platform-server\bundles there is a file 'plateform-server.umd.js'. In that they are appending css to view source you have to comment the line i have marked in image.

thanks @Anil24
@Anil24 is there any other solution instead of this hack.
I don't know.
I worked out. in app.server.module.js, add an NoRenderServerStylesHost to override the default ServerStylesHost's behavior.
import { NgModule } from '@angular/core';
import { ServerModule, ServerTransferStateModule } from '@angular/platform-server';
import { ModuleMapLoaderModule } from '@nguniversal/module-map-ngfactory-loader';
import { AppModule } from './app.module';
import { AppComponent } from './app.component';
import { 傻angular_packages_platform_server_platform_server_c as ServerStylesHost } from '@angular/platform-server';
export class NoRenderServerStylesHost extends ServerStylesHost {
onStylesAdded(additions: Set<string>): void {
// super.onStylesAdded(additions);
// additions.forEach((s) => console.log(s));
// ignore styles added
}
}
@NgModule({
imports: [
// The AppServerModule should import your AppModule followed
// by the ServerModule from @angular/platform-server.
AppModule,
ServerModule,
ModuleMapLoaderModule,
ServerTransferStateModule,
],
// Since the bootstrapped component is not inherited from your
// imported AppModule, it needs to be repeated here.
bootstrap: [AppComponent],
providers: [{
provide: ServerStylesHost,
useClass: NoRenderServerStylesHost
}]
})
export class AppServerModule {
}
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._
Most helpful comment
I worked out. in app.server.module.js, add an
NoRenderServerStylesHostto override the defaultServerStylesHost's behavior.