Skip to content

Commit dbb413b

Browse files
committed
feat: include style to inline style server render
1 parent dba5713 commit dbb413b

6 files changed

+30
-6
lines changed

angular.json

+1-3
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,6 @@
8686
"tsConfig": "src/tsconfig.spec.json",
8787
"scripts": [],
8888
"styles": [
89-
"src/styles.scss",
90-
"src/styles/main.scss"
9189
],
9290
"assets": [
9391
"src/assets",
@@ -185,4 +183,4 @@
185183
"prefix": "app"
186184
}
187185
}
188-
}
186+
}

src/app/app.server.module.ts

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// angular
2-
import { NgModule } from '@angular/core';
2+
import { NgModule, ViewEncapsulation, Component } from '@angular/core';
33
import { ServerModule, ServerTransferStateModule } from '@angular/platform-server';
44
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
55
// libs
@@ -11,17 +11,20 @@ import { TranslatesServerModule } from '@shared/translates/translates-server';
1111
// components
1212
import { AppComponent } from './app.component';
1313
import { AppModule } from './app.module';
14+
import { InlineStyleComponent } from './inline-style/inline-style.component';
15+
import { InlineStyleModule } from './inline-style/inline-style.module';
1416

1517
@NgModule({
1618
imports: [
1719
AppModule,
1820
NoopAnimationsModule,
1921
ServerTransferStateModule,
2022
ServerModule,
23+
InlineStyleModule,
2124
ModuleMapLoaderModule,
2225
TranslatesServerModule
2326
],
24-
bootstrap: [AppComponent],
27+
bootstrap: [AppComponent, InlineStyleComponent],
2528
providers: [
2629
{ provide: AppStorage, useClass: UniversalStorage }
2730
],
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
@import '../../styles/main.scss';
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import { Component, ViewEncapsulation } from '@angular/core';
2+
3+
@Component({
4+
selector: 'app-inline-style',
5+
template: '',
6+
styleUrls: ['./inline-style.component.scss'],
7+
encapsulation: ViewEncapsulation.None
8+
})
9+
10+
export class InlineStyleComponent {
11+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { NgModule } from '@angular/core';
2+
import { CommonModule } from '@angular/common';
3+
import { InlineStyleComponent } from './inline-style.component';
4+
5+
@NgModule({
6+
imports: [CommonModule],
7+
declarations: [InlineStyleComponent],
8+
exports: [InlineStyleComponent],
9+
})
10+
export class InlineStyleModule {}

src/index.html

+2-1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
<body>
1414
<app-root></app-root>
15+
<app-inline-style></app-inline-style>
1516
</body>
1617

17-
</html>
18+
</html>

0 commit comments

Comments
 (0)