많은 움직이는 부분이있는 seed project for Angular 2 주위에 머리를 감싸려고 노력하고 있는데 이해할 수없는 것을 발견했습니다 ... index.html EJS 문 것으로 보인다 무엇있다 :일반 HTML 파일 및 TypeScript의 EJS 문
<!-- src/client/index.html -->
<title><%= APP_TITLE %></title>
나는 그것이 그것을하고있어 방법, 이해가 안 (설정 파일에 정의 할 제목을 허용)하고있어 무엇을 이해하지만. 내가 express를 참조 할 수 있지만, 내가 더 혼란하게하려면 package.json
의 종속성으로 ejs 표시되지 않습니다, 거기에 비슷한 EJS 같은 다음과 같이 몇 가지 타이프 스크립트 파일에서 구문 :
// src/client/app/system-config.ts
System.config(JSON.parse('<%= SYSTEM_CONFIG_DEV %>'));
// src/client/app/app.module.ts
@NgModule({
imports: [BrowserModule, HttpModule, RouterModule.forRoot(routes), AboutModule, HomeModule, SharedModule.forRoot()],
declarations: [AppComponent],
providers: [{
provide: APP_BASE_HREF,
useValue: '<%= APP_BASE %>' // <------- this!?!?
}],
bootstrap: [AppComponent]
})
그래서이 보간법은 템플릿 외부에서 작동합니다! 이게 어떻게 작동합니까? 이 도구를 대체 할 도구 나 패키지는 무엇입니까? 나는 그것을 이해할 수 없다. 나는 서버를 실행하는 this is the code을 믿는다
/**
* Starts a new `express` server, serving the built files from `dist/prod`.
*/
export function serveProd() {
let root = resolve(process.cwd(), Config.PROD_DEST);
let server = express();
server.use(Config.APP_BASE, express.static(root));
server.use(fallback('index.html', { root }));
server.listen(Config.PORT,() =>
openResource('http://localhost:' + Config.PORT + Config.APP_BASE)
);
};
나는 Express가 밖으로의 상자, 그러나,이 .ejs
확장을 위해 파일이 필요합니다 EJS의 지원이 제공 알고있다. 나는 그것이 일반 파일 .html
을 파싱하도록 강제하는 방법이 있음을 알고 있지만, 그 코드는 각 씨드 프로젝트에 존재하지 않는 것처럼 보입니다.
이것은'index.html' 파일에 대한 설명입니다. 그러나 이것이 소스 코드 ('.ts' 파일)로 어떻게 변환되는지 아직 확실하지 않습니다. –