Useful Capistrano Rake tasks for WordPress. Currently:
opcache:clear
varnish:clear
assets:upload
andassets:build
domains:map
varnish:clear
Clears the varnish cache. Has support for Multiple domains (via Multisite). See Config.
Used to build and upload front-end assets. Assumed configuration variables: theme
and assets
.
assets:upload
Builds and uploads assets.
assets:build
Builds assets with npm run build
in the :theme
directory.
A theme directory should be set. This is used to run build the assets. For example, for bedrock:
set :theme, 'web/app/themes/<my-theme>'
You can specify assets directories from within the theme directory. These asset folders will be uploaded after building the assets. For example:
set :assets, fetch(:assets, []).push('assets/scripts/dist')
set :assets, fetch(:assets, []).push('assets/styles/dist')
To automatically build and upload assets on each deployment, you can use the deploy:updated
hook:
after "deploy:updated", "assets:upload"
domains:map
Maps domains for the WordPress MU Domain Mapping plugin when pulling the database.
Domains can be configured by setting the domains
variable. For example, in production.rb
:
set :domains, {
'www.example.com' => 'www.example-com.localhost',
'www.example.org' => 'www.example-org.localhost',
}