Repository is archived
No commit activity in last 3 years
No release in over 3 years
Package and push react assets locally
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

>= 3.1.0, ~> 3.1
 Project Readme

Capistrano React Assets

Package react assets locally (once) and upload to each host. This saves you time since the npm modules are only installed (and compiled) once, and the assets are only packaged once. The assets are then compressed, shipped, and unpacked.

Setup

Add the library to your Gemfile:

gem 'capistrano-react-assets'

Add the library to your Capfile:

require 'capistrano/react-assets'

Provide some setup and invoke the commands in your config/deploy.rb or config/deploy/ENVIRONMENT.rb:

set :assets_tar, "assets.tar.bz2"
set :assets_package_path, "public/webpack"
set :remote_assets_tar, File.join(fetch(:deploy_to), "current", fetch(:assets_tar))
set :remote_assets_path, File.join(fetch(:deploy_to), "current", fetch(:assets_package_path))

before "unicorn_restart", "react_assets:prepare_environment"
after "react_assets:prepare_environment", "react_assets:package_and_upload"
after "react_assets:package_and_upload", "react_assets:cleanup"