Skip to content

Commit

Permalink
feat: include style to inline style server render
Browse files Browse the repository at this point in the history
  • Loading branch information
Gorniv committed Sep 21, 2018
1 parent dba5713 commit dbb413b
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 6 deletions.
4 changes: 1 addition & 3 deletions angular.json
Expand Up @@ -86,8 +86,6 @@
"tsConfig": "src/tsconfig.spec.json",
"scripts": [],
"styles": [
"src/styles.scss",
"src/styles/main.scss"
],
"assets": [
"src/assets",
Expand Down Expand Up @@ -185,4 +183,4 @@
"prefix": "app"
}
}
}
}
7 changes: 5 additions & 2 deletions src/app/app.server.module.ts
@@ -1,5 +1,5 @@
// angular
import { NgModule } from '@angular/core';
import { NgModule, ViewEncapsulation, Component } from '@angular/core';
import { ServerModule, ServerTransferStateModule } from '@angular/platform-server';
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
// libs
Expand All @@ -11,17 +11,20 @@ import { TranslatesServerModule } from '@shared/translates/translates-server';
// components
import { AppComponent } from './app.component';
import { AppModule } from './app.module';
import { InlineStyleComponent } from './inline-style/inline-style.component';
import { InlineStyleModule } from './inline-style/inline-style.module';

@NgModule({
imports: [
AppModule,
NoopAnimationsModule,
ServerTransferStateModule,
ServerModule,
InlineStyleModule,
ModuleMapLoaderModule,
TranslatesServerModule
],
bootstrap: [AppComponent],
bootstrap: [AppComponent, InlineStyleComponent],
providers: [
{ provide: AppStorage, useClass: UniversalStorage }
],
Expand Down
1 change: 1 addition & 0 deletions src/app/inline-style/inline-style.component.scss
@@ -0,0 +1 @@
@import '../../styles/main.scss';
11 changes: 11 additions & 0 deletions src/app/inline-style/inline-style.component.ts
@@ -0,0 +1,11 @@
import { Component, ViewEncapsulation } from '@angular/core';

@Component({
selector: 'app-inline-style',
template: '',
styleUrls: ['./inline-style.component.scss'],
encapsulation: ViewEncapsulation.None
})

export class InlineStyleComponent {
}
10 changes: 10 additions & 0 deletions src/app/inline-style/inline-style.module.ts
@@ -0,0 +1,10 @@
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { InlineStyleComponent } from './inline-style.component';

@NgModule({
imports: [CommonModule],
declarations: [InlineStyleComponent],
exports: [InlineStyleComponent],
})
export class InlineStyleModule {}
3 changes: 2 additions & 1 deletion src/index.html
Expand Up @@ -12,6 +12,7 @@

<body>
<app-root></app-root>
<app-inline-style></app-inline-style>
</body>

</html>
</html>

0 comments on commit dbb413b

Please sign in to comment.