From 80fad83ef26a4431247cad3f432cc085c335e942 Mon Sep 17 00:00:00 2001 From: Kristóf Marussy Date: Sat, 20 Feb 2021 17:16:08 +0100 Subject: Migrate to dart-sass Currently, Hugo requires dart-sass-embedded on the PATH, because the executable is not embedded inside Hugo. The added Makefile automatically download dart-sass-embedded and sets PATH. Using dart-sass-embedded 1.0.0-beta.5 with Hugo v0.80.0/extended from Arch linux, because 1.0.0-beta.6 requires Hugo v0.81.0, which is not yet in the repositories. --- .gitignore | 4 +++- Makefile | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ content/_index.md | 8 ++++++-- themes/marussy | 2 +- 4 files changed, 65 insertions(+), 4 deletions(-) create mode 100644 Makefile diff --git a/.gitignore b/.gitignore index 1aaf957..600e5a8 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,6 @@ # Hugo default output directory /public - /resources/_gen + +# dart-sass-embedded +/vendor/sass_embedded diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..3274451 --- /dev/null +++ b/Makefile @@ -0,0 +1,55 @@ +SERVER_BASE_URL ?= https://dev.marussy.com +SERVER_PORT ?= 1313 +SERVER_LIVE_RELOAD_PORT ?= 443 +DART_SASS_EMBEDDED_VERSION ?= 1.0.0-beta.5 + +ifeq ($(origin DART_SASS_DOWNLOAD_URL), undefined) +close_paren := ) +ifeq ($(origin DART_SASS_EMBEDDED_PLATFORM), undefined) +DART_SASS_EMBEDDED_PLATFORM := $(shell case "$$(uname -s)" in \ + Linux*$(close_paren) echo 'linux' ;; \ + Darwin*$(close_paren) echo 'macos' ;; \ + CYGWIN*|MINGW*$(close_paren) echo 'windows' ;; \ + *$(close_paren) echo 'unknown' ;; \ +esac) +endif +ifeq ($(origin DART_SASS_EMBEDDED_ARCH), undefined) +DART_SASS_EMBEDDED_ARCH := $(shell case "$$(uname -m)" in \ + i?86$(close_paren) echo 'ia32' ;; \ + x86_64|amd64|arm64$(close_paren) echo 'x64' ;; \ + *$(close_paren) echo 'unknown' ;; \ +esac) +endif +DART_SASS_DOWNLOAD_URL := https://github.com/sass/dart-sass-embedded/releases/download/$(DART_SASS_EMBEDDED_VERSION)/sass_embedded-$(DART_SASS_EMBEDDED_VERSION)-$(DART_SASS_EMBEDDED_PLATFORM)-$(DART_SASS_EMBEDDED_ARCH).tar.gz +endif + +VENDOR_DIR ?= vendor + +DART_SASS_EMBEDDED_DIR := $(VENDOR_DIR)/sass_embedded +DART_SASS_EMBEDDED_BINARY := $(DART_SASS_EMBEDDED_DIR)/dart-sass-embedded + +HUGO ?= hugo +HUGO := PATH="$(DART_SASS_EMBEDDED_DIR):$${PATH}" $(HUGO) + +.PHONY: all server upgrade_dart_sass_embedded + +all: $(DART_SASS_EMBEDDED_BINARY) + +server: + @$(HUGO) server --baseUrl=$(SERVER_BASE_URL) \ + --buildDrafts \ + --disableFastRender \ + --liveReloadPort=$(SERVER_LIVE_RELOAD_PORT) \ + --minify \ + --port=$(SERVER_PORT) + +upgrade_dart_sass_embedded: + @rm -rf $(DART_SASS_EMBEDDED_DIR) + @$(MAKE) --no-print-directory $(DART_SASS_EMBEDDED_BINARY) + +$(DART_SASS_EMBEDDED_BINARY): + @echo "Downloading $(DART_SASS_DOWNLOAD_URL)..." + @mkdir -p vendor + @cd vendor && \ + rm -rf sass_embedded && \ + curl -L $(DART_SASS_DOWNLOAD_URL) | tar xz diff --git a/content/_index.md b/content/_index.md index 7204757..ea155c0 100644 --- a/content/_index.md +++ b/content/_index.md @@ -2,6 +2,10 @@ Hello World! [This is a link](/). -One morning, when **Gregor Samsa** woke from _troubled dreams,_ he found himself transformed in his bed into a [horrible vermin](/). He lay on his armour-like back, and if he lifted his head a little he could see his brown belly, slightly domed and divided by arches into stiff sections. The bedding was hardly able to cover it and seemed ready to slide off any moment. His many legs, pitifully thin compared with the size of the rest of him, waved about helplessly as he looked. "What's happened to me?" he thought. +One morning, as **Gregor Samsa** was waking up from _anxious dreams,_ he discovered that in bed he had been changed into a [monstrous verminous bug](/). He lay on his armour-hard back and saw, as he lifted his head up a little, his brown, arched abdomen divided up into rigid bow-like sections. From this height the blanket, just about ready to slide off completely, could hardly stay in place. His numerous legs, pitifully thin in comparison to the rest of his circumference, flickered helplessly before his eyes. -It wasn't a dream. His room, a proper human room although a little too small, lay peacefully between its four familiar walls. A collection of textile samples lay spread out on the table -- Samsa was a travelling salesman -- and above it there hung a picture that he had recently cut out of an illustrated magazine and housed in a nice, gilded frame. It showed a lady fitted out with a fur hat and fur boa who sat upright, raising a heavy fur muff that covered the whole of her lower arm towards the viewer. Gregor then turned to look out the window at the dull weather. +"What's happened to me," he thought. It was no dream. His room, a proper room for a human being, only somewhat too small, lay quietly between the four well-known walls. Above the table, on which an unpacked collection of sample cloth goods was spread out (Samsa was a traveling salesman) hung the picture which he had cut out of an illustrated magazine a little while ago and set in a pretty gilt frame. It was a picture of a woman with a fur hat and a fur boa. She sat erect there, lifting up in the direction of the viewer a solid fur muff into which her entire forearm disappeared. + + diff --git a/themes/marussy b/themes/marussy index ba6800a..a718ae0 160000 --- a/themes/marussy +++ b/themes/marussy @@ -1 +1 @@ -Subproject commit ba6800ad896550d56dca0b1250c51936c5fb7d8e +Subproject commit a718ae01cf23619967964852f6806ce4e76cf893 -- cgit v1.2.3-54-g00ecf