Bladeren bron

Use Hugo's built in SASS support for CSS.

master
Chris Smith 4 jaren geleden
bovenliggende
commit
17a19491cd
Getekend door: Chris Smith <chris@chameth.com> GPG sleutel-ID: 3A2D4BBDC4A3C9A9

+ 2
- 16
minify.sh Bestand weergeven

@@ -2,22 +2,8 @@
2 2
 
3 3
 set -uxeo pipefail
4 4
 
5
-# Compress all the CSS files together
6
-cat /tmp/site/res/css/*.css > "/tmp/css-concatted.css"
7
-yui-compressor "/tmp/css-concatted.css" > "/tmp/css-combined.css"
8
-
9
-# Generate a small hash to bust caches if the file changes
10
-HASH=`sha256sum /tmp/css-combined.css | cut -c -10`
11
-
12
-# Replace the old CSS with the new
13
-mv "/tmp/css-combined.css" "/tmp/site/res/stylesheet-$HASH.css"
14
-rm -rf "/tmp/site/res/css"
15
-
16
-# Replace the references in the HTML, then run tidy over it
5
+# Run tidy over all HTML 
17 6
 for file in $(find /tmp/site/ -name '*.html'); do
18
-	sed -i "s#\"/res/css/style.css\"#\"/res/stylesheet-$HASH.css\"#g" "$file"
19
-	sed -i '\#"/res/css/.*.css"#d' "$file"
20
-
21 7
 	# Tidy exits if there are warnings, which there probably will be...
22 8
 	tidy -q -i -w 120 -m --vertical-space yes --drop-empty-elements no "$file" || true
23 9
 done
@@ -25,4 +11,4 @@ done
25 11
 # Convert all images to WebP
26 12
 for file in $(find /tmp/site -name '*.jpg' -o -name '*.png' -o -name '*.jpeg'); do
27 13
 	cwebp -m 6 -mt -o "$file.webp" -- "$file"
28
-done
14
+done

+ 4
- 0
site/assets/style.sass Bestand weergeven

@@ -0,0 +1,4 @@
1
+@import style/font-awesome
2
+@import style/font-awesome.min
3
+@import style/monokai
4
+@import style/legacy

site/static/res/css/font-awesome.css → site/assets/style/font-awesome.css Bestand weergeven


site/static/res/css/font-awesome.min.css → site/assets/style/font-awesome.min.css Bestand weergeven


site/static/res/css/style.css → site/assets/style/legacy.css Bestand weergeven

@@ -1639,7 +1639,6 @@ figcaption {
1639 1639
     color: #565656;
1640 1640
     font-weight: 800;
1641 1641
     font-family: "League Spartan", sans-serif;
1642
-    .text-transform: uppercase;
1643 1642
     line-height: 1em;
1644 1643
     margin: 0 0 1em 0;
1645 1644
   }
@@ -1862,11 +1861,6 @@ figcaption {
1862 1861
     line-height: 1.3em;
1863 1862
   }
1864 1863
 
1865
-  #posts ul li a {
1866
-    .color: #ccc;
1867
-  }
1868
-
1869
-
1870 1864
 /* Form */
1871 1865
 
1872 1866
   form {

site/static/res/css/lightbox.min.css.disabled → site/assets/style/lightbox.min.css.disabled Bestand weergeven


site/static/res/css/monokai.css → site/assets/style/monokai.css Bestand weergeven


+ 2
- 1
site/config.yaml Bestand weergeven

@@ -1,7 +1,8 @@
1 1
 baseurl: https://www.chameth.com
2
+assetDir: assets
2 3
 disablePathToLower: true
3 4
 languageCode: en-gb
4 5
 title: Chameth.com
5 6
 disableKinds: ["taxonomy", "taxonomyTerm"]
6 7
 
7
-pygmentsuseclasses: true
8
+pygmentsUseClasses: true

+ 2
- 4
site/layouts/partials/head.html Bestand weergeven

@@ -16,10 +16,8 @@
16 16
     </title>
17 17
     <meta charset="utf-8">
18 18
     <meta name="viewport" content="width=device-width, initial-scale=1" />
19
-    <link rel="stylesheet" href="/res/css/style.css">
20
-    <link rel="stylesheet" href="/res/css/monokai.css">
21
-    <link rel="stylesheet" href="/res/css/font-awesome.min.css">
22
-    <link rel="stylesheet" href="/res/css/lightbox.min.css">
19
+    {{ $style := resources.Get "style.sass" | toCSS (dict "outputStyle" "compressed") | fingerprint }}
20
+    <link rel="stylesheet" href="{{ $style.Permalink }}">
23 21
     <link rel="canonical" href="{{ .Permalink }}" />
24 22
     {{ with .Site.GetPage "home" }}
25 23
       {{ with .OutputFormats.Get "RSS" }}

Laden…
Annuleren
Opslaan