Capistrano Deployment
Tailwind Stylesheet Generation
For Hyvä projects deployed with capistrano-magento2, if the production stylesheet is not kept in version control, there are a few additional steps required to generate it during deployment.
Create a file named tailwind.rake
in %MAGENTOPROJECTROOT%/lib/capistrano/tasks
with the following content:
namespace :deploy do
desc 'Build tailwindCSS'
task :hyva_tailwind_build do
on roles(:all) do
fetch(:hyva_tailwind_paths, []).each do |tailwind_path|
within release_path + tailwind_path do
execute :npm, :ci
execute :npm, :run, "build-prod"
end
end
end
end
end
config/deploy.rb
file:
and in the same file add the tailwind task:
If you have more than one Hyva theme, you can add more paths to the variable since it is an array.
Server Requirements
To build the production stylesheet, you need to have node and npm installed on your server.
Optional: Change node version using NVM
If you need to switch node version (for i.e. using different node version then default) you can add https://github.com/koenpunt/capistrano-nvm
Add the module to the Gemfile:
Add the module to the Capfile:
Add the settings to config/deploy.rb
file: