node package manager
Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

ng-compiler

THIS IS A WORK IN PROGRESS!

@angular/cli does not minify HTML templates before the AOT process leading to extremely bloated script bundles.

NOTES:

This currently does not work as a global package, install it locally to the project.

The input assets folder currently just gets copied over to to output assets folder. I will be using imagemin to optimize images in the assets folder in the near future (svg, png, jpeg).

STRUCTURE SUPPORTED:

I will be adding a configuration file where you can define your project structure, for now here is the hard coded project structure supported:

input:{
    root: "src",
    styles: "styles",
    assets: "assets",
    index: "index.html",
    vendor: "vendor.ts",
    bootstrap: "bootstrap.ts",
    tsconfig: "tsconfig.json"
},
output: {
    root: "dist",
    scripts: "scripts",
    styles: "styles",
    assets: "assets"
},
serve: {
    port: "9995"
}

EXAMPLE:

Below is an exagerated example of why I made this compiler. Using @angular/cli create a new project, in an HTML file just start hitting spacebar, new line, copy and paste all the useless white space just to prove the point, you will end up with a compiled AOT template that is extremely bloated and not efficient that looks like the following:

alt text

Even though this is an exagration, it is still extremely bad. Add up all the white space in your HTML (spaces, new lines) across hundreds of HTML files and it will significantly increase the size of your javascript bundles for an AOT compilation.