Generate web page
This commit is contained in:
parent
57447f79b4
commit
e6dd71ad22
2
.gitignore
vendored
2
.gitignore
vendored
@ -1,3 +1,5 @@
|
||||
*.stl
|
||||
*.3mf
|
||||
*.gcode
|
||||
*.png
|
||||
public/
|
||||
|
29
Makefile
29
Makefile
@ -1,13 +1,32 @@
|
||||
DESTDIR = public
|
||||
PARAMETERS := $(shell cat Lego.json | grep -v '"parameterSets": ""' | jq -r '.parameterSets | keys[]')
|
||||
STL = $(PARAMETERS:%=%.stl)
|
||||
STL = $(PARAMETERS:%=$(DESTDIR)/%.stl)
|
||||
PNG = $(PARAMETERS:%=$(DESTDIR)/%.png)
|
||||
INDEX = $(DESTDIR)/index.html
|
||||
SCAD = Lego.scad
|
||||
CONFIG = Lego.json
|
||||
|
||||
all: $(STL)
|
||||
.PHONY: all
|
||||
all: models thumbnails
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
rm -f $(STL)
|
||||
rm -f $(STL) $(PNG) $(INDEX)
|
||||
|
||||
$(STL): $(SCAD) $(CONFIG) Makefile
|
||||
openscad -o $@ -p $(CONFIG) -P $(@:%.stl=%) $(SCAD)
|
||||
.PHONY: models
|
||||
models: $(STL)
|
||||
|
||||
.PHONY: thumbnails
|
||||
thumbnails: $(PNG)
|
||||
|
||||
.PHONY: webpage
|
||||
webpage: thumbnails $(INDEX)
|
||||
|
||||
$(STL) $(PNG): $(SCAD) $(CONFIG) Makefile
|
||||
mkdir -p $(@D)
|
||||
openscad -o $@ -p $(CONFIG) -P $(basename $(@F)) $(SCAD)
|
||||
|
||||
$(INDEX): header.html entry.html footer.html Makefile
|
||||
cat header.html > $@
|
||||
$(foreach P,$(PARAMETERS),cat entry.html | sed 's/%/$P/g' >> $@;)
|
||||
cat footer.html >> $@
|
||||
|
4
entry.html
Normal file
4
entry.html
Normal file
@ -0,0 +1,4 @@
|
||||
<a href="%.stl">
|
||||
<h1>%</h1>
|
||||
<img src="%.png" />
|
||||
</a>
|
2
footer.html
Normal file
2
footer.html
Normal file
@ -0,0 +1,2 @@
|
||||
</body>
|
||||
</html>
|
5
header.html
Normal file
5
header.html
Normal file
@ -0,0 +1,5 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>LEGO STLs</title>
|
||||
</head>
|
||||
<body>
|
Loading…
x
Reference in New Issue
Block a user