Skip to content

Commit 5d85ba5

Browse files
committed
Fix CSS loading issue
1 parent c1d3213 commit 5d85ba5

File tree

7 files changed

+58
-52
lines changed

7 files changed

+58
-52
lines changed

.editorconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@ indent_style = tab
99

1010
[*.{html,js,json,md,sass,yaml}]
1111
indent_style = space
12-
indent_size = 2
12+
indent_size = 2

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@ preview-build:
1919
--minify
2020

2121
open:
22-
open https://cncf-hugo-starter.netlify.com
22+
open https://opencontainers.netlify.app

assets/css/dev/postcss.config.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
const themeDir = __dirname + '/../../../';
22

3-
module.exports = {
4-
plugins: [
5-
require('postcss-import')({
6-
path: [themeDir]
7-
}),
8-
require('tailwindcss')(themeDir + 'assets/css/tailwind.config.js'),
9-
require('autoprefixer'),
10-
]
3+
module.exports = {
4+
plugins: [
5+
require('postcss-import')({
6+
path: [themeDir]
7+
}),
8+
require('tailwindcss')(themeDir + 'assets/css/tailwind.config.js'),
9+
require('autoprefixer'),
10+
]
1111
}

assets/css/postcss.config.js

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,28 @@
11
const themeDir = __dirname + '/../../';
22

3-
module.exports = {
4-
plugins: [
5-
require('postcss-import')({
6-
path: [themeDir]
7-
}),
8-
require('tailwindcss')(themeDir + 'assets/css/tailwind.config.js'),
9-
// Configuration of purgecss for Tailwindcss
10-
// see https://tailwindcss.com/docs/controlling-file-size/#setting-up-purgecss
11-
require('@fullhuman/postcss-purgecss')({
12-
// Specify the paths to all of the template files in your project
13-
content: [
14-
themeDir + 'layouts/**/*.html',
15-
themeDir + 'exampleSite/content/**/*.html',
16-
'layouts/**/*.html',
17-
'content/**/*.html',
18-
],
19-
// Include any special characters you're using in this regular expression
20-
defaultExtractor: content => content.match(/[\w-/:]+(?<!:)/g) || [],
21-
fontFace: true
22-
}),
23-
require('autoprefixer')({
24-
grid: true
25-
}),
26-
require('postcss-reporter'),
27-
]
3+
module.exports = {
4+
plugins: [
5+
require('postcss-import')({
6+
path: [themeDir]
7+
}),
8+
require('tailwindcss')(themeDir + 'assets/css/tailwind.config.js'),
9+
// Configuration of purgecss for Tailwindcss
10+
// see https://tailwindcss.com/docs/controlling-file-size/#setting-up-purgecss
11+
require('@fullhuman/postcss-purgecss')({
12+
// Specify the paths to all of the template files in your project
13+
content: [
14+
themeDir + 'layouts/**/*.html',
15+
themeDir + 'exampleSite/content/**/*.html',
16+
'layouts/**/*.html',
17+
'content/**/*.html',
18+
],
19+
// Include any special characters you're using in this regular expression
20+
defaultExtractor: content => content.match(/[\w-/:]+(?<!:)/g) || [],
21+
fontFace: true
22+
}),
23+
require('autoprefixer')({
24+
grid: true
25+
}),
26+
require('postcss-reporter'),
27+
]
2828
}

layouts/_default/baseof.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77
{{- block "main" . }}{{- end }}
88
</main>
99
{{- partial "footer.html" . -}}
10-
10+
1111
{{ $app := resources.Get "js/app.js" | fingerprint }}
12-
<script src="{{ $app.RelPermalink }}" integrity="{{ $app.Data.Integrity }}"></script>
12+
<script src="{{ $app.RelPermalink }}" integrity="{{ $app.Data.Integrity }}"></script>
1313
<script src="https://unpkg.com/[email protected]/dist/ionicons.js"></script>
1414
</body>
1515
</html>

layouts/partials/head.html

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,29 @@
11
<meta charset="utf-8" />
22
<meta name="viewport" content="width=device-width, initial-scale=1" />
3-
<title>{{ block "title" . }}
4-
{{- .Title }} - {{ .Site.Title -}}
5-
{{ end }}</title>
6-
{{ if .Description }}
7-
<meta name="description" content="{{ .Description }}" />
3+
<title>
4+
{{ block "title" . }}
5+
{{- .Title }} - {{ .Site.Title -}}
6+
{{ end }}
7+
</title>
8+
9+
{{ with .Description }}
10+
<meta name="description" content="{{ . }}" />
811
{{ end }}
9-
{{ if .Keywords }}
10-
<meta name="keywords" content="{{ delimit .Keywords "," }}" />
12+
{{ with .Keywords }}
13+
<meta name="keywords" content="{{ delimit . "," }}" />
1114
{{ end }}
12-
{{ if .Params.Author }}
13-
<meta name="author" content="{{ .Params.Author}}" />
15+
{{ with .Params.Author }}
16+
<meta name="author" content="{{ . }}" />
1417
{{ end }}
15-
{{ hugo.Generator }}
18+
19+
{{ $styles := resources.Get "css/styles.css" }}
1620

1721
{{ if .Site.IsServer }}
18-
{{ $style := resources.Get "css/styles.css" | postCSS (dict "config" "./assets/css/dev/postcss.config.js") }}
19-
<link rel="stylesheet" href="{{ $style.Permalink }}">
22+
{{ $style := $styles | postCSS (dict "config" "./assets/css/dev/postcss.config.js") }}
23+
<link rel="stylesheet" href="{{ $style.RelPermalink }}">
2024
{{ else }}
21-
{{ $style := resources.Get "css/styles.css" | postCSS (dict "config" "./assets/css/postcss.config.js") | minify | fingerprint }}
22-
<link rel="stylesheet" href="{{ $style.Permalink }}" integrity="{{ $style.Data.Integrity }}">
25+
{{ $style := $styles | postCSS (dict "config" "./assets/css/postcss.config.js") | minify | fingerprint }}
26+
<link rel="stylesheet" href="{{ $style.RelPermalink }}" integrity="{{ $style.Data.Integrity }}">
2327
{{ end }}
28+
29+
{{ hugo.Generator }}

layouts/partials/header.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
</a>
77
</div>
88
</div>
9-
9+
1010
<nav class="flex flex-wrap items-center justify-between bg-white xs:flex-col sm:flex-col md:flex-col lg:flex-row">
1111
<div class="flex-none p-1 md:items-center sm:w-auto md:w-auto">
1212
<a href="{{ .Site.Home.Permalink }}" class="flex items-center">

0 commit comments

Comments
 (0)