Last active
September 27, 2024 22:49
-
-
Save mig-hub/2e8a4edb4198f6fc492f907c72c56a7c to your computer and use it in GitHub Desktop.
Revisions
-
mig-hub revised this gist
Sep 23, 2020 . 1 changed file with 24 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -12,8 +12,10 @@ MD_FILES = $(shell find $(SRC_DIR) -type f -name '*.md') HTML_FILES = $(patsubst $(SRC_DIR)/%.md, $(DST_DIR)/%.html, $(MD_FILES)) TEMPLATE = $(SRC_DIR)/template.html BASE_URL = "https://www.example.org" .PHONY: all all: html css $(DST_DIR)/robots.txt $(DST_DIR)/sitemap.xml ## Build the whole website # # HTML @@ -44,7 +46,27 @@ $(CSS_DIR): $(CSS_DIR)/%.css: $(SCSS_DIR)/%.scss $(SCSS_INCLUDES_DIR)/_*.scss | $(CSS_DIR) sass --load-path=$(SCSS_INCLUDES_DIR) --style=compressed --scss $< $@ # # Robots.txt # $(DST_DIR)/robots.txt: @echo "User-agent: *" > $@ @echo "Allow: *" >> $@ @echo "Sitemap: $(BASE_URL)/sitemap.xml" >> $@ # # Sitemap.xml # $(DST_DIR)/sitemap.xml: $(HTML_FILES) @echo '<?xml version="1.0" encoding="UTF-8"?><urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">' > $@ for f in $^; do \ @echo "<url><loc>$(BASE_URL)$${f#$(DST_DIR)}<loc></url>" >> $@ done @echo '</urlset>' >> $@ # # Helpers # -
mig-hub revised this gist
Aug 19, 2020 . 2 changed files with 9 additions and 8 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -10,6 +10,7 @@ CSS_FILES=$(patsubst $(SCSS_DIR)/%.scss, $(CSS_DIR)/%.css, $(SCSS_FILES)) MD_FILES = $(shell find $(SRC_DIR) -type f -name '*.md') HTML_FILES = $(patsubst $(SRC_DIR)/%.md, $(DST_DIR)/%.html, $(MD_FILES)) TEMPLATE = $(SRC_DIR)/template.html .PHONY: all all: html css ## Build the whole website @@ -24,6 +25,13 @@ html: $(HTML_FILES) ## Build all HTML files from SLIM files (even nested) $(DST_DIR)/%.html: $(SRC_DIR)/%.md pandoc --from markdown --to html --standalone $< -o $@ $(DST_DIR)/%.html: $(SRC_DIR)/%.md $(TEMPLATE) pandoc \ --from markdown_github+smart+yaml_metadata_block+auto_identifiers \ --to html \ --template $(TEMPLATE) \ -o $@ $< # # CSS # @@ -49,4 +57,4 @@ clean: .PHONY: help help: ## Show this help @egrep -h '\s##\s' $(MAKEFILE_LIST) | \ awk 'BEGIN {FS = ":.*?## "}; {printf "\033[34m%-15s\033[0m %s\n", $$1, $$2}' This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,7 +0,0 @@ -
mig-hub revised this gist
Aug 19, 2020 . 1 changed file with 7 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,7 @@ all: html css html: echo "Building some HTML..." css: echo "Building some CSS..." -
mig-hub created this gist
Aug 19, 2020 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,52 @@ SRC_DIR = src DST_DIR = build CSS_DIR = $(DST_DIR)/css SCSS_DIR = $(SRC_DIR)/scss SCSS_INCLUDES_DIR = $(SCSS_DIR)/includes SCSS_FILES = $(wildcard $(SCSS_DIR)/*.scss) CSS_FILES=$(patsubst $(SCSS_DIR)/%.scss, $(CSS_DIR)/%.css, $(SCSS_FILES)) MD_FILES = $(shell find $(SRC_DIR) -type f -name '*.md') HTML_FILES = $(patsubst $(SRC_DIR)/%.md, $(DST_DIR)/%.html, $(MD_FILES)) .PHONY: all all: html css ## Build the whole website # # HTML # .PHONY: html html: $(HTML_FILES) ## Build all HTML files from SLIM files (even nested) $(DST_DIR)/%.html: $(SRC_DIR)/%.md pandoc --from markdown --to html --standalone $< -o $@ # # CSS # .PHONY: css css: $(CSS_FILES) ## Build all CSS files from SCSS $(CSS_DIR): mkdir -p $@ $(CSS_DIR)/%.css: $(SCSS_DIR)/%.scss $(SCSS_INCLUDES_DIR)/_*.scss | $(CSS_DIR) sass --load-path=$(SCSS_INCLUDES_DIR) --style=compressed --scss $< $@ # # Helpers # .PHONY: clean clean: rm $(HTML_FILES) rm -rf $(CSS_DIR) .PHONY: help help: ## Show this help @egrep -h '\s##\s' $(MAKEFILE_LIST) | \ awk 'BEGIN {FS = ":.*?## "}; {printf "\033[34m%-15s\033[0m %s\n", $$1, $$2}'