Skip to content
Open
Show file tree
Hide file tree
Changes from 2 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: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
!.sonarcloud.properties
!.mailmap

src/argus/htmx/static/styles.css

# local config files
cmd.sh
localsettings.py
Expand Down
19 changes: 12 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
.PHONY: clean testclean distclean coverageclean cacheclean nuke tailwind docclean upgrade-tailwind tailwind-watch

TAILWINDDIR=src/argus/htmx/tailwindtheme
STATICDIR=src/argus/htmx/static
PYTHONPATH=./src
.PHONY: clean build testclean distclean docclean coverageclean cacheclean nuke tailwindcli tailwind tailwind-watch upgrade-tailwind

STYLE_SOURCES := $(shell find src/argus -name '*.html')
TAILWINDDIR:=src/argus/htmx/tailwindtheme
STATICDIR:=src/argus/htmx/static
PYTHONPATH:=./src

clean:
-find . -name __pycache__ -print0 | xargs -0 rm -rf
-find . -name "*.pyc" -print0 | xargs -0 rm -rf
-find . -name "*.egg-info" -print0 | xargs -0 rm -rf

build: tailwind

cacheclean:
-find . -name ".ruff_cache" -print0 | xargs -0 rm -rf

Expand All @@ -31,8 +33,11 @@ testclean: coverageclean clean

nuke: clean docclean distclean testclean cacheclean

tailwind:
$(TAILWINDDIR)/tailwindcss -c $(TAILWINDDIR)/tailwind.config.js -i $(TAILWINDDIR)/styles.css -o $(STATICDIR)/styles.css
tailwindcli:
@which tailwind || echo "tailwindcss not in path"

tailwind: tailwindcli
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After removing the $(TAILWINDDIR)/ prefix, it no longer uses the specific version for this project. My global tailwindcss is version 4, while the repo uses tailwind 3, so I get an error when trying to run make build. I think the build pipeline should also use make upgrade-tailwind or at least make sure to install the current defined version.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed, but this doesn't do anything to the one in $PATH

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How does macOS handle $PATH?

tailwindcss -c $(TAILWINDDIR)/tailwind.config.js -i $(TAILWINDDIR)/styles.css -o $(STATICDIR)/styles.css

tailwind-watch:
$(TAILWINDDIR)/tailwindcss -c $(TAILWINDDIR)/tailwind.config.js -i $(TAILWINDDIR)/styles.css -o $(STATICDIR)/styles.css --watch
Expand Down
134 changes: 73 additions & 61 deletions docs/customization/htmx-frontend.rst
Original file line number Diff line number Diff line change
Expand Up @@ -41,70 +41,82 @@ example.
Themes and styling
==================

How to customize the look:

* Override Argus' Tailwind CSS theme defaults and/or choose which daisyUI color
themes to include. You can do so by updating the default
:setting:`TAILWIND_THEME_OVERRIDE` and :setting:`DAISYUI_THEMES` settings
respectively before running a ``tailwind_config`` management command:

Via environment variables, for example::

TAILWIND_THEME_OVERRIDE = '
{
"borderWidth": {
"DEFAULT": "1px"
},
"extend": {
"borderRadius": {
"4xl": "2rem"
}
}
}
'
DAISYUI_THEMES = '
[
"light",
"dark",
"cyberpunk",
"dim",
"autumn",
{ "mytheme": {
"color-scheme": "dark",
"primary": "#009eb6",
"primary-content": "#00090c",
"secondary": "#00ac00",
"secondary-content": "#000b00",
"accent": "#ff0000",
"accent-content": "#160000",
"neutral": "#262c0e",
"neutral-content": "#cfd1ca",
"base-100": "#292129",
"base-200": "#221b22",
"base-300": "#1c161c",
"base-content": "#d0cdd0",
"info": "#00feff",
"info-content": "#001616",
"success": "#b1ea50",
"success-content": "#0c1302",
"warning": "#d86d00",
"warning-content": "#110400",
"error": "#ff6280",
"error-content": "#160306"
}
}
]
'
In order to customize the CSS you need to have ``tailwindcss`` in the shell
``$PATH``. Running ``make upgrade-tailwind`` will download a binary to
``src/argus/htmx/tailwindtheme/tailwindcss`` which can then be copied or linked
to a directory in $PATH, or you can add the absolute path to the parent
directory of ``tailwindcss`` to your ``$PATH`` by changing the environment
variable as per your shell.

Alter themes
------------

Override Argus' Tailwind CSS theme defaults and/or choose which daisyUI color
themes to include. You can do so by updating the default
:setting:`TAILWIND_THEME_OVERRIDE` and :setting:`DAISYUI_THEMES` settings
respectively before running a ``tailwind_config`` management command:

Via environment variables, for example::

TAILWIND_THEME_OVERRIDE = '
{
"borderWidth": {
"DEFAULT": "1px"
},
"extend": {
"borderRadius": {
"4xl": "2rem"
}
}
}
'
DAISYUI_THEMES = '
[
"light",
"dark",
"cyberpunk",
"dim",
"autumn",
{ "mytheme": {
"color-scheme": "dark",
"primary": "#009eb6",
"primary-content": "#00090c",
"secondary": "#00ac00",
"secondary-content": "#000b00",
"accent": "#ff0000",
"accent-content": "#160000",
"neutral": "#262c0e",
"neutral-content": "#cfd1ca",
"base-100": "#292129",
"base-200": "#221b22",
"base-300": "#1c161c",
"base-content": "#d0cdd0",
"info": "#00feff",
"info-content": "#001616",
"success": "#b1ea50",
"success-content": "#0c1302",
"warning": "#d86d00",
"warning-content": "#110400",
"error": "#ff6280",
"error-content": "#160306"
}
}
]
'

Or by providing corresponding values in your local settings that star-imports from an `argus-server`_ settings file::
Or by providing corresponding values in your local settings that star-imports from an `argus-server`_ settings file::

TAILWIND_THEME_OVERRIDE = {...}
DAISYUI_THEMES = [...]
TAILWIND_THEME_OVERRIDE = {...}
DAISYUI_THEMES = [...]

Some links that may be relevant for the customization values mentioned above:
* `daisyUI themes`_
* `list of daisyUI color names`_
* `Tailwind CSS theme customization`_
Some links that may be relevant for the customization values mentioned above:

* `daisyUI themes`_
* `list of daisyUI color names`_
* `Tailwind CSS theme customization`_

Alter CSS and stylesheets
-------------------------

* Override the default main stylesheet path by setting
``ARGUS_STYLESHEET_PATH`` in the environment. The path is under
Expand Down
9 changes: 9 additions & 0 deletions docs/development/howtos/release-checklist.rst
Original file line number Diff line number Diff line change
Expand Up @@ -180,3 +180,12 @@ Checklist
#. Copy the changelog into the box below, dedent the headers once.

#. Finally, click the "Publish release"-button. Done!

Post-release clean up
---------------------

The packaging will have generated package files in ``dist/``, these can be
removed by running ``make distclean``.

The file ``src/argus/htmx/static/styles.css`` will also have been regenerated,
don't commit it so as to keep merge conflicts down.
11 changes: 10 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[build-system]
requires = ["hatchling", "versioningit>=3.0.0"]
requires = ["hatchling", "hatch-build-scripts", "versioningit>=3.0.0"]
build-backend = "hatchling.build"

[project]
Expand Down Expand Up @@ -88,6 +88,15 @@ exclude = [
"/*.sh",
]

[[tool.hatch.build.hooks.build-scripts.scripts]]
# build css
commands = [
"make tailwind"
]
artifacts = [
"src/argus/htmx/static/styles.css",
]

[tool.versioningit.write]
file = "src/argus/version.py"

Expand Down
Loading