Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix many bugs #30

Merged
merged 1 commit into from
Nov 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ Refer to [`defaults/main/ansible.yml`](defaults/main/ansible.yml) for config ref

### Page content

Refer to [`defaults/main/LauncherTW.yml`)](defaults/main/LauncherTW.yml) for page content configuration.
Refer to [`vars.example.yml`](vars.example.yml) for page content configuration.

## Credits

Expand Down
3 changes: 3 additions & 0 deletions defaults/main/ansible.yml → defaults/main.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
---
##### GENERAL PLAYBOOK SETTINGS #####

# [REQUIRED] Font Awesome version number. Must use Font Awesome version 6.x
font_awesome_version: 6.7.1

# playbook operation, 'build' or 'deploy'
# 'build' - only run build, do not deploy
# 'deploy' - build and deploy to target host (configuration required)
Expand Down
9 changes: 1 addition & 8 deletions tasks/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
path: /tmp
prefix: LauncherTW_
state: directory
changed_when: false
register: _temp_dir
- name: Set output to temp directory
ansible.builtin.set_fact:
Expand All @@ -18,15 +17,13 @@
path: "{{ launchertw_build_output_dir }}/css"
mode: "0750"
state: directory
changed_when: false
register: _css_dir

- name: Copy static assets to output dir
ansible.builtin.copy:
src: "{{ item }}"
dest: "{{ launchertw_build_output_dir }}"
mode: "0640"
changed_when: false
loop:
- img
- robots.txt
Expand All @@ -41,9 +38,9 @@
- fontawesome-free-{{ font_awesome_version }}-web/css/all.min.css
- fontawesome-free-{{ font_awesome_version }}-web/webfonts/fa-brands-400.woff2
- fontawesome-free-{{ font_awesome_version }}-web/webfonts/fa-solid-900.woff2
changed_when: false

- name: Build Tailwind CSS
changed_when: true
ansible.builtin.command:
chdir: "{{ role_path }}"
argv:
Expand All @@ -56,7 +53,6 @@
- files/css/launcher.css
- -o
- "{{ _css_dir.path }}/launcher.min.css"
changed_when: false

- name: Get checksum of css output
ansible.builtin.stat:
Expand All @@ -68,16 +64,13 @@
src: "{{ _css_dir.path }}/launcher.min.css"
dest: "{{ _css_dir.path }}/launcher.min.{{ _css_stat.stat.checksum }}.css"
mode: "0640"
changed_when: false
- name: Remove original css output
ansible.builtin.file:
path: "{{ _css_dir.path }}/launcher.min.css"
state: absent
changed_when: false

- name: Generate index HTML
ansible.builtin.template:
src: index.html.j2
dest: "{{ launchertw_build_output_dir }}/index.html"
mode: "0640"
changed_when: false
12 changes: 8 additions & 4 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,14 @@
- name: Validate operation
ansible.builtin.assert:
that:
- launchertw_operation == 'build' or launchertw_operation == 'deploy'
- launchertw_build_output_dir is defined and launchertw_build_output_dir
- launchertw_deploy_target_dir is defined and launchertw_deploy_target_dir
- font_awesome_version is defined and font_awesome_version.startswith('6')
- launchertw_operation in ('build', 'deploy')
# launchertw_build_output_dir is required for 'build'
- launchertw_operation == 'deploy' or launchertw_build_output_dir
# launchertw_deploy_target_dir is required for 'deploy'
- launchertw_operation == 'build' or launchertw_deploy_target_dir
# Font Awesome v6.x
- font_awesome_version is version('6.0.0', 'gt', version_type='semver')
- font_awesome_version is version('7.0.0', 'lt', version_type='semver')

- name: Build site on localhost
ansible.builtin.import_tasks: build.yml
Expand Down
8 changes: 4 additions & 4 deletions templates/index.html.j2
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
<body class="bg-zinc-100 dark:bg-zinc-900">
<div class="max-w-7xl mx-auto px-6 py-12">
<!-- Header -->
{% if header_links is defined -%}
<div class="md:flex">
<div>
<a href=""><h1 class="text-5xl font-bold dark:text-gray-100">{{ page_title }}</h1></a>
</div>
{% if header_links is defined and header_links -%}
<div class="ml-auto self-center my-4">
{% for item in header_links -%}
<a href="{{ item.url }}" {% if item.newtab is defined and item.newtab %}rel="noopener noreferrer" target="_blank"{% endif %}
Expand All @@ -27,10 +27,10 @@
</a>
{%- endfor +%}
</div>
{%- endif +%}
</div>
{%- endif +%}
<hr class="bg-zinc-200 dark:bg-zinc-700 mt-4 mb-6 border-none h-px">
{%+ if announcement is defined -%}
{%+ if announcement is defined and announcement -%}
<!-- Announcement banner -->
<div class="rounded-t-md bg-yellow-400 py-2 px-5">
<p class="text-lg font-semibold">
Expand Down Expand Up @@ -63,7 +63,7 @@
{% endif +%}
{%- endfor +%}
<!-- Footer link button -->
{%+ if footer_link is defined -%}
{%+ if footer_link is defined and footer_link -%}
<hr class="bg-zinc-200 dark:bg-zinc-700 mt-5 mb-4 border-none h-px">
<div class="text-center pt-3">
<a class="text-sm dark:text-gray-200 rounded-lg bg-neutral-200 hover:bg-neutral-300 dark:bg-neutral-800 dark:hover:bg-neutral-700 py-3 px-3 w-fit"
Expand Down
3 changes: 0 additions & 3 deletions defaults/main/LauncherTW.yml → vars.example.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
---
# Heavily inspired by Homer (github.com/bastienwirtz/homer)

# [REQUIRED] Font Awesome version number. Must use Font Awesome version 6.x
font_awesome_version: 6.2.0

# [REQUIRED] title of the page: shown in header and as HTML <title>
page_title: LauncherTW

Expand Down