Keep source assets in staging or production env?

Hello,
I use this script for build my theme assets in production:

That work perfectly, but if I understand well, this script build the assets locally and then copying the files to the remote server.

In this case is it a good practice to keep the source assets in the remote server? If not, what is the best way to remove the source assets to the remote server?

Doesn’t really matter that much. But all you need to do is make a list of files/folders you dont want and in a hook file, delete them.

We used to have something like this:

- name: Remove unwanted files/folders from new release
    file:
      path: "{{ deploy_helper.new_release_path }}/{{ item }}"
      state: absent
 -  with_items: project_unwanted_items

You can just define project_unwanted_items:

project_unwanted_items:
  - some/file
  - path/to/folder
1 Like