3

I am using webpack on my app and use GitHub as my remote repo and then deploy to Heroku for production. I have a folder that has all my client files that I work on, so I want to store all of this on my GitHub repo but not on Heroku because they're just going to take up unnecessary space since they will be wrapped up in a bundle anyway. What are the best practices to commit only the client files to GitHub and only the bundle file to Heroku?

stackjlei
  • 9,485
  • 18
  • 65
  • 113

2 Answers2

0

Typically, you could separate those tasks in two Git repository:

  • one for your regular files, with regular push to GitHub
  • one where you can:
    • run bundle install on the first repo
    • get the result bundle into the second repo and heroku push only that (a bit like in this answer)
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
0

The heroku documentation says:

If your repository contains files not necessary to run your app, you may wish to add these to a .slugignore file in the root of your repository.

The format is roughly the same as .gitignore. Here’s an example .slugignore:

# Heres a comment
*.psd
*.pdf
/test
/spec

The .slugignore file causes files to be removed after you push code to Heroku and before the buildpack runs. This lets you prevent large files from being included in the final slug. Unlike .gitignore, .slugignore does not support negated ! patterns.

Boris K
  • 1,469
  • 9
  • 29