Skip to content

Commit

Permalink
Update CD2 theme CSS file if changed
Browse files Browse the repository at this point in the history
The playbook only re-compiled the LESS-file of the CD2 playbook if a
compiled version was not present, which meant that the compiled
version was not updated when the LESS-file changed.

The playbook re-compiles the LESS-file every time now, and updates
the CSS-file if the output has changed.
  • Loading branch information
stsnel committed Apr 29, 2024
1 parent 40524a5 commit c12f813
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions roles/ckan/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -214,8 +214,23 @@

- name: Compile CD² theme CSS
ansible.builtin.command:
cmd: 'lessc "{{ ckan_cd2_theme_css_less }}" "{{ ckan_cd2_theme_css_custom }}"'
creates: '{{ ckan_cd2_theme_css_custom }}'
cmd: 'lessc "{{ ckan_cd2_theme_css_less }}" "{{ ckan_cd2_theme_css_custom }}.tmp-ansible"'
changed_when: false


- name: Check whether CD² theme has changed
ansible.builtin.command:
cmd: diff "{{ ckan_cd2_theme_css_custom }}" "{{ ckan_cd2_theme_css_custom }}.tmp-ansible"
failed_when: ckan_theme_diff_output.rc > 1
changed_when: false
register: ckan_theme_diff_output


- name: Update CD² theme if needed
ansible.builtin.command:
cmd: cp "{{ ckan_cd2_theme_css_custom }}.tmp-ansible" "{{ ckan_cd2_theme_css_custom }}"
changed_when: true
when: ckan_theme_diff_output.rc == 1


- name: Install CD2-config repository
Expand Down

0 comments on commit c12f813

Please sign in to comment.