Skip to content

Commit

Permalink
ci: Minifiy static files
Browse files Browse the repository at this point in the history
Signed-off-by: Vincent Boutour <[email protected]>
  • Loading branch information
ViBiOh committed Nov 3, 2022
1 parent defcdc7 commit d3d55e2
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ jobs:
uses: actions/setup-go@v3
with:
go-version: '^1.19'
- name: Minify
run: |
apt-get install minify
make build-web
- name: Build
run: |
curl --disable --silent --show-error --location --max-time 30 "https://raw.githubusercontent.com/ViBiOh/scripts/main/bootstrap" | bash -s -- "-c" "release"
Expand Down
8 changes: 8 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,14 @@ bench:
build:
CGO_ENABLED=0 go build -ldflags="-s -w" -installsuffix nocgo -o bin/$(APP_NAME) $(MAIN_SOURCE)

## build: Build the application.
.PHONY: build-web
build-web:
minify "cmd/fibr/static/scripts/async-image.js" > "cmd/fibr/static/scripts/async-image.min.js" && mv "cmd/fibr/static/scripts/async-image.min.js" "cmd/fibr/static/scripts/async-image.js"
minify "cmd/fibr/static/scripts/map.js" > "cmd/fibr/static/scripts/map.min.js" && mv "cmd/fibr/static/scripts/map.min.js" "cmd/fibr/static/scripts/map.js"
minify "cmd/fibr/static/scripts/navigation.js" > "cmd/fibr/static/scripts/navigation.min.js" && mv "cmd/fibr/static/scripts/navigation.min.js" "cmd/fibr/static/scripts/navigation.js"
minify "cmd/fibr/static/styles/main.css" > "cmd/fibr/static/styles/main.min.css" && mv "cmd/fibr/static/styles/main.min.css" "cmd/fibr/static/styles/main.css"

## run: Locally run the application, e.g. node index.js, python -m myapp, go run myapp etc ...
.PHONY: run
run:
Expand Down
6 changes: 1 addition & 5 deletions cmd/fibr/static/scripts/map.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,7 @@ async function renderMap(geoURL) {
bounds.push(coord);
markers.addLayer(
L.circleMarker(coord).bindPopup(
`<a href="${f.properties.url}?browser">
<img src="${f.properties.url}?thumbnail" alt="Image thumbnail" class="thumbnail-img">
</a>
<br>
<span>${f.properties.date}</span>`,
`<a href="${f.properties.url}?browser"><img src="${f.properties.url}?thumbnail" alt="Image thumbnail" class="thumbnail-img"></a><br><span>${f.properties.date}</span>`,
{
maxWidth: 'auto',
closeButton: false,
Expand Down

0 comments on commit d3d55e2

Please sign in to comment.