Last active
December 29, 2017 15:48
-
-
Save msyvr/8451908f99ef29d09a9fa54dcd095240 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This details how best to manage assets in the rails pipeline for deployment to heroku: | |
http://www.akitaonrails.com/2017/06/28/rails-5-1-heroku-deployment-checklist-for-heroku | |
" | |
Make sure you have 2 boot files, first the canonical Procfile to be used by Heroku in production: | |
1 web: bin/rails server -p $PORT -b 0.0.0.0 | |
Second, a Procfile.dev to be used only in your development environment: | |
1 web: ./bin/rails server | |
2 webpacker: ./bin/webpack-dev-server | |
This is how you fire up the webpack server that will compile your assets in real-time during development. You need to also remember to run these two dependency commands first (before webpacker): | |
1 yarn install | |
2 bundle install | |
" | |
First, to install webpack to an existing Rails 5.1 app, per: | |
https://github.com/rails/webpacker#installation | |
" | |
Or add it to your Gemfile, run bundle and ./bin/rails webpacker:install or bundle exec rake webpacker:install (on rails version < 5.0): | |
# Gemfile | |
gem 'webpacker', '~> 2.0' | |
# OR if you prefer to use master | |
gem 'webpacker', git: 'https://github.com/rails/webpacker.git' | |
" | |
***Remember that webpacker requires Yarn version >= 0.20.1. (Download and install the latest version from https://yarnpkg.com/lang/en/docs/install/) | |
Order of installs: | |
$ brew install yarn | |
and then the rake task: | |
$ bundle exec rake webpacker:install | |
The preceding yields many lines of log, ending with: | |
Webpacker successfully installed 🎉 🍰 | |
To precompile assets: | |
bundle exec rake assets:precompile | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment