Compare commits

..

2 Commits

Author SHA1 Message Date
Sean Dockray 1ce60da9cf allow specifying branch for main render 2020-09-07 22:55:17 +10:00
Sean Dockray f959140f2a rendering css 2020-09-07 22:49:30 +10:00
3 changed files with 10 additions and 8 deletions

View File

@ -53,6 +53,7 @@ vars = {
'tmp_dir': '/tmp',
'force': False,
'branch': None,
'preview_branch': None,
}
# logging time
@ -156,19 +157,19 @@ published = False
refs = cmd([GIT_PATH, 'diff-tree', '--no-commit-id', '--name-only', REF], cwd=GIT_REPO).split("\n")
for r in refs:
if FORCE or r == "PUBLISH.trigger.md":
build_site(WEBSITE, TMP_WEBSITE)
build_site(WEBSITE, TMP_WEBSITE, branch=BRANCH)
published = True
# Check if there is a !publish!
if not published:
refs = cmd([GIT_PATH, 'show', '--format="%s"', '-s'], cwd=GIT_REPO).split(' ')
for r in refs:
if r == "!publish!":
build_site(WEBSITE, TMP_WEBSITE)
build_site(WEBSITE, TMP_WEBSITE, branch=BRANCH)
published = True
# Let the world know if there hasn't been a publish
if not published:
print("The site wasn't build because there was no publish trigger, nor was it forced.")
# create preview version
build_site(WEBSITE_PREVIEW, TMP_WEBSITE_PREVIEW, branch=BRANCH, hugo_environment='preview')
build_site(WEBSITE_PREVIEW, TMP_WEBSITE_PREVIEW, branch=PREVIEW_BRANCH, hugo_environment='preview')
# @TODO: link the library

1
static/css/site.css Normal file

File diff suppressed because one or more lines are too long

View File

@ -1,8 +1,8 @@
{{ if eq hugo.Environment "gitea" }}
{{ if (or (eq hugo.Environment "gitea") (eq hugo.Environment "preview") ) }}
<link rel="stylesheet" href="/css/site.css">
{{ else if .Site.IsServer }}
{{ $style := resources.Get "css/site.css" | postCSS (dict "config" "./assets/css/postcss.config.js") | minify | fingerprint }}
<link rel="stylesheet" href="{{ $style.Permalink }}" integrity="{{ $style.Data.Integrity }}">
{{ $style := resources.Get "css/site.css" | postCSS (dict "config" "./assets/css/postcss.config.js") | minify }}
<link rel="stylesheet" href="{{ $style.Permalink }}">
{{ else }}
{{ $flist := newScratch }}
{{ $flist.Set "initial" "nop" }}
@ -21,7 +21,7 @@
{{ if in $css "css" }}
<link rel="stylesheet" href="{{ "/css/" }}{{ $css }}">
{{ else }}
{{ $style := resources.Get "css/site.css" | postCSS (dict "config" "./assets/css/postcss.config.js") | minify | fingerprint }}
<link rel="stylesheet" href="{{ $style.Permalink }}" integrity="{{ $style.Data.Integrity }}">
{{ $style := resources.Get "css/site.css" | postCSS (dict "config" "./assets/css/postcss.config.js") | minify }}
<link rel="stylesheet" href="{{ $style.Permalink }}">
{{ end }}
{{ end }}