• Trellis

Remove Theme Source Files on Deploy

Avoid exposing your theme source files on the web by removing them during your Trellis deployments.

In most scenarios, you probably don’t want someone digging into the .scss and .js files you used to build your theme. We can tell Trellis to remove the source folder for your asset builds by using the hooks in Trellis deploys.

Create a new file in trellis/deploy-hooks/build-after.yml:

- name: Remove theme source files
    state: absent
    path: "{{ deploy_helper.new_release_path }}/web/app/themes/[theme name]/resources/assets"

Add to trellis/group_vars/all/main.yml:

  - "{{ playbook_dir }}/roles/deploy/hooks/build-after.yml"
  - "{{ playbook_dir }}/deploy-hooks/build-after.yml"

Start the discussion on Roots Discourse

Ready to checkout?