-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
49 lines (38 loc) · 1.51 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
.PHONY: all
all: build ## Build the site (default target)
.PHONY: build
build: ## Build the Hugo site
@hugo
.PHONY: serve run dev
serve run dev: ## Run the local Hugo development server
@hugo serve
.PHONY: log
log: ## Create log post
@python scripts/log.py
.PHONY: til
til: ## Create a new TIL (Today I Learned) post
@python scripts/til.py $(p)
.PHONY: sync
sync: ## Sync content with Obsidian vault
@unison content "/Users/danielcorin/Library/Mobile Documents/iCloud~md~obsidian/Documents/obsidian/30 Resources/blog" -batch -auto -prefer newer
.PHONY: post
post: ## Create a new blog post
@hugo new "posts/$(shell date +%Y)/$(p).md"
.PHONY: db
db: ## Build the site sqlite database
@python scripts/build_database.py
.PHONY: tags
tags: ## List all tags used in the blog
python -m scripts.list_tags
.PHONY: images
images: ## Optimize images in the specified directory (usage: make images d=path/to/dir)
find $(d) -type f -name "*.png" -exec pngquant --quality=65-80 --ext=.png --force {} \;
find $(d) -type f \( -iname "*.jpg" -o -iname "*.jpeg" \) -exec jpegoptim --max=80 --strip-all {} \;
find $(d) -type f -name "*.gif" -exec gifsicle -O3 --colors 256 -o {} {} \;
.PHONY: nbs
nbs: ## Convert Jupyter notebooks to posts
@find content -name "*.ipynb" -print0 | xargs -0 -P 4 -I {} python -m scripts.convert_notebook {}
.PHONY: help
help: ## Display this help message
@echo "Available targets:"
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf " %-10s %s\n", $$1, $$2}'