Skip to content

Commit 1f96657

Browse files
committed
fix CSS
1 parent 79603a2 commit 1f96657

File tree

10 files changed

+65
-9
lines changed

10 files changed

+65
-9
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ package-lock.json
66
yarn.lock
77
prerender.js
88
prerender.js
9+
.DS_Store

server.ts

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,22 @@ const fs = require('fs');
33
const path = require('path');
44
const template = fs.readFileSync(path.join(__dirname, '.', 'dist', 'index.html')).toString();
55
const win = domino.createWindow(template);
6+
const files = fs.readdirSync(`${process.cwd()}/dist-server`);
7+
const styleFiles = files.filter(file => file.startsWith('styles'));
8+
const hashStyle = styleFiles[0].split('.')[1];
9+
const style = fs.readFileSync(path.join(__dirname, '.', 'dist-server', `styles.${hashStyle}.bundle.css`)).toString();
10+
611
global['window'] = win;
12+
Object.defineProperty(win.document.body.style, 'transform', {
13+
value: () => {
14+
return {
15+
enumerable: true,
16+
configurable: true
17+
};
18+
},
19+
});
720
global['document'] = win.document;
21+
global['CSS'] = style;
822
// global['XMLHttpRequest'] = require('xmlhttprequest').XMLHttpRequest;
923
global['Prism'] = null;
1024

@@ -17,7 +31,7 @@ import * as compression from 'compression';
1731
import * as cookieparser from 'cookie-parser';
1832
const { provideModuleMap } = require('@nguniversal/module-map-ngfactory-loader');
1933

20-
const files = fs.readdirSync(`${process.cwd()}/dist-server`);
34+
2135
const mainFiles = files.filter(file => file.startsWith('main'));
2236
const hash = mainFiles[0].split('.')[1];
2337
const { AppServerModuleNgFactory, LAZY_MODULE_MAP } = require(`./dist-server/main.${hash}.bundle`);

src/app/app.routing.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ const routes: Routes = [
66
{ path: 'primeng', loadChildren: './primengPage/primengPage.module#PrimengPageModule' },
77
{ path: 'mock', loadChildren: './mock-server-browser/mock-server-browser.module#MockServerBrowserModule' },
88
{ path: 'ionic', loadChildren: './ionic-page/ionic-page.module#IonicPageModule' },
9+
{ path: 'back', loadChildren: './transfer-back/transfer-back.module#TransferBackModule' },
910
];
1011

1112
export const AppRoutes = RouterModule.forRoot(routes);

src/app/home/home.component.html

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
<p>
22
home works!
33
</p>
4-
result
5-
<br/>
6-
{{result | json}}
7-
<br/>
4+
85

src/app/home/home.component.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,13 @@ import { Component, OnInit, Inject } from '@angular/core';
88
styleUrls: ['./home.component.scss']
99
})
1010
export class HomeComponent implements OnInit {
11-
result: any;
1211

1312
constructor(
1413
private http: TransferHttp, @Inject(AppStorage) private appStorage: Storage
1514
) { }
1615

1716
ngOnInit(): void {
18-
this.http.get('https://reqres.in/api/users?delay=3').subscribe(result => {
19-
this.result = result;
20-
});
17+
2118
this.appStorage.setItem('test', 'test2');
2219
const resultCookie = this.appStorage.getItem('test');
2320
const t = window;
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
delay back 3 sec =
2+
<br/>
3+
{{result | json}}
4+
<br/>

src/app/transfer-back/transfer-back.component.scss

Whitespace-only changes.
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import { AppStorage } from './../../forStorage/universal.inject';
2+
import { TransferHttp } from './../../modules/transfer-http/transfer-http';
3+
import { Component, OnInit, Inject } from '@angular/core';
4+
5+
@Component({
6+
selector: 'app-transfer-back',
7+
templateUrl: './transfer-back.component.html',
8+
styleUrls: ['./transfer-back.component.scss']
9+
})
10+
export class TransferBackComponent implements OnInit {
11+
result: any;
12+
13+
constructor(private http: TransferHttp, @Inject(AppStorage) private appStorage: Storage) { }
14+
15+
ngOnInit() {
16+
this.http.get('https://reqres.in/api/users?delay=3').subscribe(result => {
17+
this.result = result;
18+
});
19+
}
20+
21+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { TransferBackRoutes } from './transfer-back.routing';
2+
import { NgModule } from '@angular/core';
3+
import { CommonModule } from '@angular/common';
4+
import { TransferBackComponent } from './transfer-back.component';
5+
6+
@NgModule({
7+
imports: [
8+
CommonModule,
9+
TransferBackRoutes
10+
],
11+
declarations: [TransferBackComponent]
12+
})
13+
export class TransferBackModule { }
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import { TransferBackComponent } from './transfer-back.component';
2+
import { Routes, RouterModule } from '@angular/router';
3+
4+
const routes: Routes = [
5+
{ path: '' , component: TransferBackComponent},
6+
];
7+
8+
export const TransferBackRoutes = RouterModule.forChild(routes);

0 commit comments

Comments
 (0)