about summary refs log tree commit diff stats
path: root/cmd
diff options
context:
space:
mode:
Diffstat (limited to 'cmd')
-rw-r--r--cmd/build/build.go36
1 files changed, 2 insertions, 34 deletions
diff --git a/cmd/build/build.go b/cmd/build/build.go
index a8ce710..ddc7a6b 100644
--- a/cmd/build/build.go
+++ b/cmd/build/build.go
@@ -2,7 +2,6 @@ package main
 
 import (
 	"bytes"
-	"encoding/json"
 	"encoding/xml"
 	"fmt"
 	"io"
@@ -11,7 +10,6 @@ import (
 	"log/slog"
 	"net/url"
 	"os"
-	"os/exec"
 	"path"
 	"path/filepath"
 	"slices"
@@ -125,45 +123,15 @@ func readPosts(root string, inputDir string, outputDir string) ([]Post, Tags, er
 	return posts, tags, nil
 }
 
-type purgeCSSOutput struct {
-	CSS  string `json:"css"`
-	File string
-}
-
-var purgedCSS map[string]string
-
-func purgeCSS(htmlFilename string, cssFilename string) (string, error) {
-	if purgedCSS == nil {
-		purgedCSS = make(map[string]string)
-	} else if purgedCSS[htmlFilename] == "" {
-		slog.Debug("running purgecss", "html", htmlFilename, "css", cssFilename)
-		bytes, err := exec.Command("bun", "./node_modules/.bin/purgecss", "--css", cssFilename, "--content", htmlFilename).Output()
-		if err != nil {
-			return "", errors.WithMessage(err, "failed running `purgecss` command")
-		}
-		var out []purgeCSSOutput
-		err = json.Unmarshal(bytes, &out)
-		if err != nil {
-			return "", errors.WithMessage(err, "failed decoding `purgecss` output")
-		}
-		purgedCSS[htmlFilename] = out[0].CSS
-	}
-	return purgedCSS[htmlFilename], nil
-}
-
 func layout(filename string, config Config, pageTitle string) (*goquery.Document, error) {
 	html, err := os.Open(filename)
 	if err != nil {
 		return nil, err
 	}
 	defer html.Close()
-	css, err := purgeCSS(filename, "templates/style.css")
+	css, err := os.ReadFile("templates/style.css")
 	if err != nil {
-		bytes, err := os.ReadFile("templates/style.css")
-		if err != nil {
-			return nil, err
-		}
-		css = string(bytes)
+		return nil, err
 	}
 	doc, err := goquery.NewDocumentFromReader(html)
 	if err != nil {