first build production with aot
ng build --prod
--prod build is a 'meta' flag, that set other flags. If you do not specify --prod you will get the --dev defaults.
--prod sets:
--aot as true
--environment as prod
--output-hashing as all
--sourcemaps as false
--extract-css as true
--extract-licenses Extract all licenses in a separate file, in the case of production builds only.
--i18n-file Localization file to use for i18n.
--prod also sets the following non-flaggable settings:
- Adds service worker if configured in .angular-cli.json.
- Replaces process.env.NODE_ENV in modules with the production value (this is needed for some libraries, like react).
- Runs UglifyJS on the code.
instal angular-cli-ghpages:
npm i -g angular-cli-ghpages
which works as per:
ng build --prod --base-href "https://USERNAME.github.io/REPOSITORY_NAME/" angular-cli-ghpages [OPTIONS]
so in case of coffee-project app after building run:
ngh --repo=https://github.com/coffee-project/coffee-project.github.io.git --branch=master