我决定使用模板引擎(比如JADE/PUG)来使用via Angluar 2.0来澄清和清理开发大型单页应用程序(SPA)的代码,我只是想获得一个非常好的性能应用程序。
我的组合是: HTML5+CSS (SASS)+角2+引导
我的问题是,使用模板引擎来澄清和清理开发大型单页应用程序(SPA)和角2.0的代码是否合理?我读过关于玉器的文章,但现在有疑问了。
发布于 2016-12-28 09:16:57
..。我建议您(基于我当前的堆栈)使用HTML,但是在外部文件中,...and通过请求将它链接到组件.所以webpack可以为你做魔术休息。
例如:
import { Component, AfterViewInit, ElementRef } from '@angular/core';
import "fullcalendar";
require('style!fullcalendar/dist/fullcalendar.css');
@Component({
selector: 'about',
template: require('./about.component.html'),
styles: [String(require('./about.component.scss'))]
})
export default class AboutComponent implements AfterViewInit {
calendarElement: any;
public message: string;
constructor(private elementRef: ElementRef) { }
ngAfterViewInit() {
this.calendarElement = jQuery(this.elementRef.nativeElement);
this.calendarElement.fullCalendar({});
}
}如您所见,在组件中包含外部sass文件时,我也使用相同的内容
发布于 2016-12-28 08:54:47
JADE不适合SPA。
JADE是一种服务器端视图技术,它使用所需的数据呈现HTML,适合于传统的非SPA应用程序。
在SPA中,您只需要从服务器获得数据(而不是每次HTML )。
https://stackoverflow.com/questions/41358403
复制相似问题