Deploying your application
When you run grunt build, it generates a completely optimized version of your application in a dist directory that can be deployed.
The recommended way of deploying the dist directory is using git subtree.
Remove the
distdirectory from the.gitignorefile.Add the
distdirectory to your repository and commit it with your project.git add dist && git commit -m "Initial dist subtree commit"Once the
distdirectory is part of your project we can usegit subtreeto set up a separate repository on a different branch.// Deploying dist to GitHub Pages git subtree push --prefix dist origin gh-pagesNote: prefix must be the relative path to your
distdirectory. This is assumingdistis in your root directory.Now you can commit to your entire repository in your default (master) branch and whenever you want to deploy the
distdirectory you can run:git subtree push --prefix dist origin gh-pages
Some common errors
- By default the
distdirectory is going to be ignored by git. It is important to remove it from the .gitignore file. - You must first commit your
distdirectory to the default (master) branch before running the git subtree command. - The
git subtreecommand must be called from the root directory. - The
--prefixoption must be the relative path to yourdistdirectory. - GitHub Pages uses the
gh-pagesbranch for deploying project pages. Users & Organization Pages use themasterbranch. This means you might want to use master as your subtree branch and set up a different branch for your app source. - You might get an error like this
Updates were rejected because the tip of your current branch is behind. You can solve this by force pushing to the remote (be careful though, it will destroy whatever is already there).