Theme main.css: Cache busting

One extra note: It can be helpful to add an extra nvm use command at
the beginning for using the right node version.

For specific node LTS series (6.x)
echo "6" > .nvmrc

In deploy build-before hook:

- name: Use specific node version
  shell: . $NVM_DIR/nvm.sh && nvm install && nvm use
  connection: local
  args:
    chdir: "{{ project.local_path }}/web/app/themes/the-theme"


# Paths
- shell: . $NVM_DIR/nvm.sh && dirname $(nvm which | tail -1)
  connection: local
  args:
    chdir: "{{ project.local_path }}/web/app/themes/the-theme"
  register: nvm_which

- shell: yarn global bin
  connection: local
  environment:
    PATH: "{{nvm_which.stdout}}:{{ ansible_env.PATH }}"
  register: yarn_global_bin


# Build
- name: Run yarn install (for global packages)
  command: yarn global add bower gulp gulp-cli
  connection: local
  environment:
    PATH: "{{yarn_global_bin.stdout}}:{{nvm_which.stdout}}:{{ ansible_env.PATH }}"

- name: Run yarn install
  command: yarn install
  connection: local
  args:
    chdir: "{{ project.local_path }}/web/app/themes/the-theme"
  environment:
    PATH: "{{yarn_global_bin.stdout}}:{{nvm_which.stdout}}:{{ ansible_env.PATH }}"

- name: Run bower install
  command: bower install
  connection: local
  args:
    chdir: "{{ project.local_path }}/web/app/themes/the-theme"
  environment:
    PATH: "{{yarn_global_bin.stdout}}:{{nvm_which.stdout}}:{{ ansible_env.PATH }}"

- name: Run gulp
  command: gulp --production
  connection: local
  args:
    chdir: "{{ project.local_path }}/web/app/themes/the-theme"
  environment:
    PATH: "{{yarn_global_bin.stdout}}:{{nvm_which.stdout}}:{{ ansible_env.PATH }}"

[...]
1 Like