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
distdirectory from the
distdirectory to your repository and commit it with your project.
git add dist && git commit -m "Initial dist subtree commit"
distdirectory is part of your project we can use
git subtreeto set up a separate repository on a different branch.
// Deploying dist to GitHub Pages git subtree push --prefix dist origin gh-pages
Note: prefix must be the relative path to your
distdirectory. This is assuming
distis 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.
git subtreecommand must be called from the root directory.
--prefixoption must be the relative path to your
- GitHub Pages uses the
gh-pagesbranch for deploying project pages. Users & Organization Pages use the
masterbranch. 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).