From c19eb9104e9091ce05b7330e7381c778304868c5 Mon Sep 17 00:00:00 2001 From: efim Date: Sat, 28 Oct 2023 15:51:34 +0000 Subject: [PATCH] init: gnumake for live restarts on src \ tailwind --- Makefile | 35 +++++++++++++++++++++++++++++++++++ flake.nix | 2 ++ main.go | 2 +- routes/static/out.css | 10 +++++----- routes/templates/index.gohtml | 2 +- 5 files changed, 44 insertions(+), 7 deletions(-) create mode 100644 Makefile diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..0e13ec2 --- /dev/null +++ b/Makefile @@ -0,0 +1,35 @@ +## +# Project Title +# Some Automoderation +# +# @file +# @version 0.1 +TEMPLATES = $(wildcard routes/templates/*.gohtml routes/templates/**/*.gohtml) +TAILWIND_OUT = routes/static/out.css +TAILWIND_IN = routes/in.css +TAILWIND_CONF = tailwind.config.js + +# if we need to run just one time, with all dependencies built first +.PHONY: run +run: tailwindcss + go run . + +# this uses wgo to re-execute 'make run' +# which will toggle tailwind out.css build only if necessery +# and then do `go run .` to rebuild all else +.PHONY: run/live +run/live: + wgo -verbose -file=.go -file=.gohtml -file=$(TAILWIND_CONF) make run + +# this is alias to concrete task that will build out.css +.PHONY: tailwindcss +tailwindcss: $(TAILWIND_OUT) + +# this is concrete task to build out.css file +# having as 'concrete' allows to not rebuild the output when inputs haven't changed +# then having .PHONY tailwindcss is easier to specify as dependency, +# but also i think phony tasks are "always" executed when depended upon +$(TAILWIND_OUT): $(TEMPLATES) $(TAILWIND_IN) $(TAILWIND_CONF) + tailwindcss -i $(TAILWIND_IN) -o $(TAILWIND_OUT) + +# end diff --git a/flake.nix b/flake.nix index d6b1be4..068b04f 100644 --- a/flake.nix +++ b/flake.nix @@ -12,9 +12,11 @@ devShells.default = pkgs.mkShell { buildInputs = [ pkgs.go + pkgs.wgo pkgs.semgrep pkgs.gopls pkgs.nodePackages.tailwindcss + pkgs.gnumake ]; shellHook = '' export GOPATH=$PWD/.go diff --git a/main.go b/main.go index d79483b..31ac437 100644 --- a/main.go +++ b/main.go @@ -13,7 +13,7 @@ func main() { flag.IntVar(&port, "port", 8080, "Port on which the server should start") flag.Parse() - fmt.Printf("Server will start on port %d", port) + fmt.Printf("Server will start on port %d\n", port) routes.RegisterRoutes() diff --git a/routes/static/out.css b/routes/static/out.css index d678215..23f9e02 100644 --- a/routes/static/out.css +++ b/routes/static/out.css @@ -534,12 +534,12 @@ video { --tw-backdrop-sepia: ; } -.bg-amber-600 { - --tw-bg-opacity: 1; - background-color: rgb(217 119 6 / var(--tw-bg-opacity)); -} - .bg-amber-400 { --tw-bg-opacity: 1; background-color: rgb(251 191 36 / var(--tw-bg-opacity)); } + +.text-xl { + font-size: 1.25rem; + line-height: 1.75rem; +} diff --git a/routes/templates/index.gohtml b/routes/templates/index.gohtml index 6bfdd54..e62ea0f 100644 --- a/routes/templates/index.gohtml +++ b/routes/templates/index.gohtml @@ -13,7 +13,7 @@