Electron App
. Why angular-cli?

Posted by in Software, Tutorial

The decision has been made for me since I’m new to Angular in general and the CLI offers a package deal particularly where code generation and initial package management is concerned. There’s also the boon of webpack, which is used as engine.

Although the balance tilts heavily in favour of using angular-cli, this package also has a bunch of flaws, apparent to me also because of the end target:

  • No multiple webpack configs. Angular CLI only has an optimised configuration and doesn’t expose hooks to be able to alter it :(
  • Verbose generators. I like the fact that it generates everything for you, but, coming from a java world, the idea of having the tests, templates and functional code in the same place is quite annoying.

Generate the app

Generating the Angular 2 app with angular-cli is a breeze:

  1. Install angular-cli as a global package
  2. Run ng new --style scss yourAppName.

Hey, presto! you have now a simple angular app you can serve with npm start (which executes ng serve in package.json). It even does the initial git preparation, it’ll allow you to generate modules, components etc.

Note: At this stage, all we have is a simple web application, which you can run in a browser.

A little experiment: If you find this post and ad below useful, please check the ad out :-)