Skip to content

Commit

Permalink
Merge branch 'v3'
Browse files Browse the repository at this point in the history
  • Loading branch information
bep committed May 23, 2023
2 parents 8ae46ba + f0ae373 commit 34c85c1
Show file tree
Hide file tree
Showing 15 changed files with 1,057 additions and 1,732 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
node_modules/
public/
resources/
hugo_stats.json
hugo_stats.json
.hugo_build.lock
Empty file added .hugo_build.lock
Empty file.
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"autoHide.autoHidePanel": false
}
31 changes: 27 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# hugo-starter-tailwind-basic
# Hugo Basic Starter for TailwindCSS v3.x

[![Netlify Status](https://api.netlify.com/api/v1/badges/5a510ba1-96b4-4834-9a07-913dce4b5061/deploy-status)](https://app.netlify.com/sites/lucid-nightingale-60a4e2/deploys)

Expand All @@ -18,18 +18,41 @@ hugo server

## As a Theme

Import `github.com/bep/hugo-starter-tailwind-basic/v2` (use `github.com/bep/hugo-starter-tailwind-basic` if you want/need Tailwind 1.x.) into your project, and then run:
Import `github.com/bep/hugo-starter-tailwind-basic/v3` (use `github.com/bep/hugo-starter-tailwind-basic/v2` if you want/need Tailwind 2.x.) into your project, and then run:

```bash
hugo mod npm pack
npm install
```

You need to add this to your `config.toml` (the stats are used by the CSS purging):
You need to add (something like) this to your `hugo.toml`:

```toml
[module]
[module.hugoVersion]
extended = false
min = "0.112.0"
[[module.mounts]]
source = "assets"
target = "assets"
[[module.mounts]]
source = "hugo_stats.json"
target = "assets/watching/hugo_stats.json"

[build]
writeStats = true
writeStats = true
[[build.cachebusters]]
source = "assets/watching/hugo_stats\\.json"
target = "styles\\.css"
[[build.cachebusters]]
source = "(postcss|tailwind)\\.config\\.js"
target = "css"
[[build.cachebusters]]
source = "assets/.*\\.(js|ts|jsx|tsx)"
target = "js"
[[build.cachebusters]]
source = "assets/.*\\.(.*)$"
target = "$1"
```

Then run your project as usual.
8 changes: 4 additions & 4 deletions assets/css/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
@import "components/all.css";

html {
font-size: 14px;
font-size: 14px;
}

@screen md {
html {
font-size: 16px;
}
html {
font-size: 16px;
}
}
12 changes: 0 additions & 12 deletions config.toml

This file was deleted.

4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module github.com/bep/hugo-starter-tailwind-basic/v2
module github.com/bep/hugo-starter-tailwind-basic/v3

go 1.15
go 1.19
29 changes: 29 additions & 0 deletions hugo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
baseURL = "https://example.org"

disableKinds = ["page", "section", "taxonomy", "term"]

[module]
[module.hugoVersion]
extended = false
min = "0.112.0"
[[module.mounts]]
source = "assets"
target = "assets"
[[module.mounts]]
source = "hugo_stats.json"
target = "assets/watching/hugo_stats.json"

[build]
writeStats = true
[[build.cachebusters]]
source = "assets/watching/hugo_stats\\.json"
target = "styles\\.css"
[[build.cachebusters]]
source = "(postcss|tailwind)\\.config\\.js"
target = "css"
[[build.cachebusters]]
source = "assets/.*\\.(js|ts|jsx|tsx)"
target = "js"
[[build.cachebusters]]
source = "assets/.*\\.(.*)$"
target = "$1"
8 changes: 4 additions & 4 deletions layouts/_default/baseof.html
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
<!doctype html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta charset="utf-8" />
<title>
{{ .Title }}
</title>
<meta name="description" content="{{ .Description }}">
<meta name="description" content="{{ .Description }}" />
{{/* styles */}}
{{ $options := dict "inlineImports" true }}
{{ $styles := resources.Get "css/styles.css" }}
{{ $styles = $styles | resources.PostCSS $options }}
{{ if hugo.IsProduction }}
{{ if hugo.IsProduction }}
{{ $styles = $styles | minify | fingerprint | resources.PostProcess }}
{{ end }}
<link href="{{ $styles.RelPermalink }}" rel="stylesheet" />
Expand Down
15 changes: 10 additions & 5 deletions layouts/index.html
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
{{ define "main" }}
<article class="prose lg:prose-xl">
<h1 class="text-4xl">
{{ .Title }}
</h1>
{{ .Content }}
<h1>Tailwind 3 Hugo Starter</h1>

<h2 class="text-4xl">Testing Tailwind 3 Features</h2>
<div>
<button class="bg-[green] p-4">Share on Twitter</button>
</div>

<h2 class="text-4xl">Markdowns: {{ .Title }}</h2>
{{ .Content }}..
</article>
{{ end }}
{{ end }}
6 changes: 3 additions & 3 deletions netlify.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,19 @@ publish = "public"
command = "hugo --gc --minify -d public;"

[context.production.environment]
HUGO_VERSION = "0.97.3"
HUGO_VERSION = "0.112.0"

[context.branch-deploy]
command = "hugo --minify --gc -d public -b $DEPLOY_PRIME_URL"

[context.branch-deploy.environment]
HUGO_VERSION = "0.97.3"
HUGO_VERSION = "0.112.0"

[context.deploy-preview]
command = "hugo --gc --minify --buildFuture -b $DEPLOY_PRIME_URL"

[context.deploy-preview.environment]
HUGO_VERSION = "0.97.3"
HUGO_VERSION = "0.112.0"

[[headers]]
for = "/*.jpg"
Expand Down
Loading

0 comments on commit 34c85c1

Please sign in to comment.