build: more sensible css file naming
continuous-integration/drone/pr Build is passing

less hardcoding of names in build script
This commit is contained in:
Darragh Elliott
2025-09-01 11:34:12 +00:00
parent 48d368283b
commit fd3e1c6d5f
6 changed files with 16 additions and 20 deletions
+11 -14
View File
@@ -17,31 +17,28 @@ def update_css(
) -> None:
"""
If any less files have been changed, update the css.
Compile less found at website/look/(fsfe.less|valentine.less)
Compile less found at <website>/look/(main*less)
Then minify it, and place it in the expected location for the build process.
"""
logger.info("Updating css")
directory = source_dir.joinpath("look")
if directory.exists():
for name in ["fsfe", "valentine"]:
if directory.joinpath(name + ".less").exists() and (
not directory.joinpath(name + ".min.css").exists()
or any(
(
path.stat().st_mtime
> directory.joinpath(name + ".min.css").stat().st_mtime
for path in directory.glob("**/*.less")
),
)
for file in directory.glob("main*.less"):
minified_path = file.with_suffix(".min.css")
if not minified_path.exists() or any(
(
path.stat().st_mtime > minified_path.stat().st_mtime
for path in directory.glob("**/*.less")
),
):
logger.info("Compiling %s.less", name)
logger.info("Compiling %s", file)
result = run_command(
[
"lessc",
str(directory.joinpath(name + ".less")),
str(file),
],
)
update_if_changed(
directory.joinpath(name + ".min.css"),
minified_path,
minify.string("text/css", result),
)
+2 -2
View File
@@ -54,7 +54,7 @@
<xsl:element name="link">
<xsl:attribute name="rel">stylesheet</xsl:attribute>
<xsl:attribute name="media">all</xsl:attribute>
<xsl:attribute name="href"><xsl:value-of select="$urlprefix"/>/look/valentine.min.css</xsl:attribute>
<xsl:attribute name="href"><xsl:value-of select="$urlprefix"/>/look/main.valentine.min.css</xsl:attribute>
<xsl:attribute name="type">text/css</xsl:attribute>
</xsl:element>
</xsl:when>
@@ -63,7 +63,7 @@
<xsl:element name="link">
<xsl:attribute name="rel">stylesheet</xsl:attribute>
<xsl:attribute name="media">all</xsl:attribute>
<xsl:attribute name="href"><xsl:value-of select="$urlprefix"/>/look/fsfe.min.css?20230215</xsl:attribute>
<xsl:attribute name="href"><xsl:value-of select="$urlprefix"/>/look/main.min.css?20230215</xsl:attribute>
<xsl:attribute name="type">text/css</xsl:attribute>
</xsl:element>
</xsl:otherwise>
+1 -2
View File
@@ -1,6 +1,5 @@
# css
look/fsfe.min.css
look/valentine.min.css
look/main*.min.css
# automatically generate subdirectory stuff
events/????/index.??.xhtml
events/????/index.sources
@@ -1,4 +1,4 @@
@import "style";
@import "base";
@import "elements/banners";
@import "elements/color-box";
@import "elements/details";
@@ -1,4 +1,4 @@
@import "fsfe.less";
@import "main.less";
/* apply valentine's day colors*/
@brand-primary: #9e1321;