Skip to content

Instantly share code, notes, and snippets.

@rafszul
Last active July 18, 2017 05:07
Show Gist options
  • Save rafszul/59d5d454c2b2817ba725e2c2a3639456 to your computer and use it in GitHub Desktop.
Save rafszul/59d5d454c2b2817ba725e2c2a3639456 to your computer and use it in GitHub Desktop.
github pages for angular-cli -->> https://www.npmjs.com/package/angular-cli-ghpages and `ng build --prod` command

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment