I'd like to make another attempt at using Angular 2
Ahead-of-Time compilation.
This will require a significant refactoring on my part because my current setup uses a custom build process that will need to be changed.
Before I start I need to know: if I link to external .scss
files in the styleUrls
metadata, will the AoT compiler work?
@Component({
...
styleUrls:['./app.component.scss'],
})
export class AppComponent {}
Or should I first convert all my styles to .css
and link to CSS stylesheets instead?
The readme doesn't discuss this.
The Angular ahead-of-time (AOT) compiler converts your Angular HTML and TypeScript code into efficient JavaScript code during the build phase before the browser downloads and runs that code. Compiling your application during the build process provides a faster rendering in the browser.
Angular applications are styled with standard CSS. That means you can apply everything you know about CSS stylesheets, selectors, rules, and media queries directly to Angular applications. Additionally, Angular can bundle component styles with components, enabling a more modular design than regular stylesheets.
AOT. JIT downloads the compiler and compiles code exactly before Displaying in the browser. AOT has already complied with the code while building your application, so it doesn't have to compile at runtime. Loading in JIT is slower than the AOT because it needs to compile your application at runtime.
Angular compilationThe ng build command with the --prod meta-flag (ng build --prod) compiles with AOT by default.
SASS (.scss
files) are not successfully processed by the ahead-of-time compiler (ngc
). I've had to convert my stylesheets to .css
first
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With