forked from mmistakes/minimal-mistakes
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
49 lines (42 loc) · 1.84 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: help setup draft serve clean stop
.DEFAULT_GOAL = help
help:
@printf "Usage:\n"
@grep -E '^[a-zA-Z_-]+:.*?# .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?# "}; {printf "\033[1;34mmake %-10s\033[0m%s\n", $$1, $$2}'
setup: # Set up environment for blogging and development.
bundle install
draft: # Start a draft blog post.
( \
DATE="$(shell date +%Y-%m-%d)"; \
touch $$DATE-draft.md; \
echo "---" >> $$DATE-draft.md; \
echo "title:" >> $$DATE-draft.md; \
echo "excerpt:" >> $$DATE-draft.md; \
echo "tags:" >> $$DATE-draft.md; \
echo " - " >> $$DATE-draft.md; \
echo "header:" >> $$DATE-draft.md; \
echo " overlay_image: /assets/images/cool-backgrounds/cool-background1.png" >> $$DATE-draft.md; \
echo " caption: 'Photo credit: [coolbackgrounds.io](https://coolbackgrounds.io/)'" >> $$DATE-draft.md; \
echo "last_modified_at:" >> $$DATE-draft.md; \
echo "search: false" >> $$DATE-draft.md; \
echo "---" >> $$DATE-draft.md; \
echo "" >> $$DATE-draft.md; \
echo "{% if page.noindex == true %}" >> $$DATE-draft.md; \
echo " <meta name=\"robots\" content=\"noindex\">" >> $$DATE-draft.md; \
echo "{% endif %}" >> $$DATE-draft.md; \
echo "" >> $$DATE-draft.md; \
mv $$DATE-draft.md _drafts/; \
)
serve: # Serve site locally.
bundle exec jekyll serve --incremental
test: # Test generated HTML files.
# Ignore broken links from /r/TheRedPill and Tweets (some people delete tweets)
bundle exec jekyll build --future
bundle exec htmlproofer ./_site/ --only-4xx --check-html --url-ignore "/reddit.com\/r\/TheRedPill/,/twitter.com\/[a-zA-Z0-9_]*\/status\/[0-9]*/"
compress: # Compress images losslessly
jpegoptim assets/images/*.jpg
optipng assets/images/*.png
optipng assets/images/cool-backgrounds/*.png
clean: # Remove _site/ and _posts/_site/ directories
rm -rf Gemfile.lock package-lock.json _site/ _posts/_site/ vendor/
jekyll clean