summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakob L. Kreuze <zerodaysfordays@sdf.org>2025-11-26 15:46:29 -0500
committerJakob L. Kreuze <zerodaysfordays@sdf.org>2025-11-26 15:46:29 -0500
commitcb059c186fb13e80ae7b3c16749588d6772d7472 (patch)
tree84626468e87509ca7d55ab38758a9fe1ebde7a20
parent5d38e8c780a38a3344c43be4fff5c717fcf8a736 (diff)
Template into single files
-rw-r--r--.gitignore1
-rw-r--r--Makefile17
-rw-r--r--README.md5
-rw-r--r--deck-editor.html.tpl (renamed from deck-editor.html)8
-rw-r--r--srs-anywhere.html.tpl (renamed from srs-anywhere.html)8
5 files changed, 35 insertions, 4 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..2d19fc7
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+*.html
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..a4b9412
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,17 @@
+all: srs-anywhere.html deck-editor.html
+
+srs-anywhere.html: srs-anywhere.html.tpl style.css srs-anywhere.js
+ sed '/@@JS@@/r srs-anywhere.js' < srs-anywhere.html.tpl | \
+ sed '/@@JS@@/d' | \
+ sed '/@@CSS@@/r style.css' | \
+ sed '/@@CSS@@/d' > srs-anywhere.html
+
+deck-editor.html: deck-editor.html.tpl style.css deck-editor.js
+ sed '/@@JS@@/r deck-editor.js' < deck-editor.html.tpl | \
+ sed '/@@JS@@/d' | \
+ sed '/@@CSS@@/r style.css' | \
+ sed '/@@CSS@@/d' > deck-editor.html
+
+.PHONY: all clean
+clean:
+ rm *.html
diff --git a/README.md b/README.md
index d048e0b..c6511f4 100644
--- a/README.md
+++ b/README.md
@@ -8,6 +8,11 @@ SRS Anywhere is free software: you can redistribute it and/or modify it under th
SRS Anywhere is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License along with SRS Anywhere. If not, see <https://www.gnu.org/licenses/.>.
+## Building
+
+Just run `make`.
+The build process is very simple, it just tangles the CSS and JavaScript code into an HTML template using `sed`.
+
## Usage
Open `srs-anywhere.html` in a web browser and press the "Browse..." button in the top right-hand corner to load a deck of cards.
diff --git a/deck-editor.html b/deck-editor.html.tpl
index d4fca8a..1f778d3 100644
--- a/deck-editor.html
+++ b/deck-editor.html.tpl
@@ -3,7 +3,9 @@
<head>
<meta charset="UTF-8">
<title>SRS Anywhere Card Editor</title>
- <link rel="stylesheet" href="style.css">
+ <style>
+ @@CSS@@
+ </style>
</head>
<body>
<div class="status-section">
@@ -12,6 +14,8 @@
</div>
<h1>SRS Anywhere Card Editor</h1>
<div id="table-container"></div>
- <script src="card-editor.js"></script>
+ <script>
+ @@JS@@
+ </script>
</body>
</html>
diff --git a/srs-anywhere.html b/srs-anywhere.html.tpl
index 879c6e8..cf3010f 100644
--- a/srs-anywhere.html
+++ b/srs-anywhere.html.tpl
@@ -4,7 +4,9 @@
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>SRS Anywhere</title>
- <link rel="stylesheet" href="style.css">
+ <style>
+ @@CSS@@
+ </style>
</head>
<body style="display: flex;">
<div id="flashcard">
@@ -73,7 +75,9 @@
</div>
</div>
- <script src="srs-anywhere.js"></script>
+ <script>
+ @@JS@@
+ </script>
<script src="srs-anywhere-custom-card-types.js"></script>
</body>
</html>