commit 40d193b330443ea074f42674ed18f463fc8e422e
parent 0990b4df19b1e8c42c8a1c22fc77fb9e836b379c
Author: Kévin Le Gouguec <kevin.legouguec@gmail.com>
Date: Sun, 7 Feb 2021 19:20:16 +0100
Move images and stylesheets in subfolders
Diffstat:
16 files changed, 59 insertions(+), 46 deletions(-)
diff --git a/Makefile b/Makefile
@@ -1,27 +1,39 @@
OUTDIR = public
+dirname = $(patsubst %/,%,$(dir $(1)))
+dirnames = $(sort $(call dirname,$(1)))
+
pages_src = $(filter-out template.html,$(wildcard *.html))
pages = $(foreach p,$(pages_src),$(OUTDIR)/$(p))
-sheets = $(wildcard *.css)
-images = $(wildcard *.svg)
feeds = $(wildcard *.xml)
-resources_src = $(sheets) $(images) $(feeds)
+resources_src = $(feeds)
resources = $(foreach f,$(resources_src),$(OUTDIR)/$(f))
+images = $(foreach img,$(shell find images -type f),$(OUTDIR)/$(img))
+images_folders = $(call dirnames,$(images))
+
+stylesheets = $(foreach img,$(shell find stylesheets -type f),$(OUTDIR)/$(img))
+stylesheets_folders = $(call dirnames,$(stylesheets))
.PHONY: all clean site
all: site
-site: $(pages) $(resources)
+site: $(pages) $(resources) $(images) $(stylesheets)
-$(OUTDIR):
+$(OUTDIR) $(images_folders) $(stylesheets_folders):
mkdir $@
$(resources): $(OUTDIR)/%: % | $(OUTDIR)
cp $< $@
+$(images): $(OUTDIR)/%: % | $(images_folders)
+ cp $< $@
+
+$(stylesheets): $(OUTDIR)/%: % | $(stylesheets_folders)
+ cp $< $@
+
# TODO: optional dependency to .sh template parameters.
$(pages): $(OUTDIR)/%.html: %.html template.html | $(OUTDIR)
./build.sh $< $@
diff --git a/build.sh b/build.sh
@@ -38,7 +38,8 @@ sed -i s/'{TITLE}'/"${title}"/ ${output}
link_stylesheets=''
for s in "${stylesheets[@]}"
do
- link_stylesheets+=$(printf '<link rel="stylesheet" href="%s.css">\n' "${s}")
+ link_template='<link rel="stylesheet" href="stylesheets/%s.css">\n'
+ link_stylesheets+=$(printf "${link_template}" "${s}")
done
sed -i /'{STYLESHEETS}'/'c\'"${link_stylesheets}" ${output}
diff --git a/calendar.svg b/images/calendar.svg
diff --git a/close.svg b/images/close.svg
diff --git a/menu.svg b/images/menu.svg
diff --git a/share.svg b/images/share.svg
diff --git a/index.css b/index.css
@@ -1,35 +0,0 @@
-body {
- background-color: #a33;
-}
-
-main {
- position: relative;
-}
-
-#next-concert {
- position: absolute;
- bottom: 4%;
- height: 20ex;
- width: 10em;
- text-align: center;
- background: no-repeat center/contain url('calendar.svg');
-}
-
-#next-concert a {
- display: inline-block;
- width: 100%;
- height: 100%;
- text-decoration: none;
-}
-
-#next-concert p {
- position: relative;
- top: 48%;
- margin: 0;
- color: #eee;
-}
-
-#next-concert #day {
- font-size: 180%;
- font-weight: bold;
-}
diff --git a/actualités.css b/stylesheets/actualités.css
diff --git a/commun.css b/stylesheets/commun.css
diff --git a/contact.css b/stylesheets/contact.css
diff --git a/gallerie.css b/stylesheets/gallerie.css
diff --git a/stylesheets/index.css b/stylesheets/index.css
@@ -0,0 +1,35 @@
+body {
+ background-color: #a33;
+}
+
+main {
+ position: relative;
+}
+
+#next-concert {
+ position: absolute;
+ bottom: 4%;
+ height: 20ex;
+ width: 10em;
+ text-align: center;
+ background: no-repeat center/contain url('/images/calendar.svg');
+}
+
+#next-concert a {
+ display: inline-block;
+ width: 100%;
+ height: 100%;
+ text-decoration: none;
+}
+
+#next-concert p {
+ position: relative;
+ top: 48%;
+ margin: 0;
+ color: #eee;
+}
+
+#next-concert #day {
+ font-size: 180%;
+ font-weight: bold;
+}
diff --git a/membre.css b/stylesheets/membre.css
diff --git a/programmes.css b/stylesheets/programmes.css
diff --git a/quatuor.css b/stylesheets/quatuor.css
diff --git a/template.html b/template.html
@@ -4,7 +4,7 @@
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>{TITLE} - Quatuor Camelot</title>
- <link rel="stylesheet" href="commun.css">
+ <link rel="stylesheet" href="stylesheets/commun.css">
{STYLESHEETS}
<link rel="alternate" type="application/rss+xml" href="feed.xml">
</head>
@@ -19,8 +19,8 @@
<header class="menu togglable">
<input type="checkbox" class="toggle" id="menu">
- <img class="button open" src="menu.svg">
- <img class="button close" src="close.svg">
+ <img class="button open" src="images/menu.svg">
+ <img class="button close" src="images/close.svg">
<label for="menu">Menu</label>
<div class="content">
<nav>
@@ -48,8 +48,8 @@
<footer class="social togglable">
<input type="checkbox" class="toggle" id="social">
- <img class="button open" src="share.svg">
- <img class="button close" src="close.svg">
+ <img class="button open" src="images/share.svg">
+ <img class="button close" src="images/close.svg">
<label for="social">Nous contacter</label>
<div class="content">
<img src="https://upload.wikimedia.org/wikipedia/en/9/9f/Twitter_bird_logo_2012.svg">