combine blog and djangostatic
This commit is contained in:
parent
acea4687a4
commit
edebcf570a
|
@ -110,11 +110,8 @@ USE_TZ = True
|
||||||
|
|
||||||
STATIC_URL = 'static/'
|
STATIC_URL = 'static/'
|
||||||
|
|
||||||
STATICFILES_DIRS = [BASE_DIR / ".." / "static"]
|
|
||||||
|
|
||||||
STATICFILES_FINDERS = [
|
STATICFILES_FINDERS = [
|
||||||
"django.contrib.staticfiles.finders.AppDirectoriesFinder",
|
"django.contrib.staticfiles.finders.AppDirectoriesFinder",
|
||||||
"django.contrib.staticfiles.finders.FileSystemFinder",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
STORAGES = {
|
STORAGES = {
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
../../../static/style.css
|
|
@ -0,0 +1 @@
|
||||||
|
../../static
|
|
@ -25,7 +25,3 @@ outputFormats:
|
||||||
RSS:
|
RSS:
|
||||||
mediatype: "application/rss"
|
mediatype: "application/rss"
|
||||||
baseName: "rss"
|
baseName: "rss"
|
||||||
module:
|
|
||||||
mounts:
|
|
||||||
- source: ../static
|
|
||||||
target: assets
|
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
{{ partial "html-meta.html" . -}}
|
{{ partial "html-meta.html" . -}}
|
||||||
<title>{{ if not (or .IsHome .IsSection) }}{{ .Title }} - {{ end }}{{ .Site.Title }}</title>
|
<title>{{ if not (or .IsHome .IsSection) }}{{ .Title }} - {{ end }}{{ .Site.Title }}</title>
|
||||||
{{ $css := resources.Get "style.scss" | resources.ToCSS (dict "transpiler" "dartsass" "enableSourceMap" false) | resources.Fingerprint }}
|
{{ $css := resources.Get "static/style.scss" | resources.ToCSS (dict "transpiler" "dartsass" "enableSourceMap" false) | resources.Fingerprint }}
|
||||||
<link rel="stylesheet" href="{{ $css.RelPermalink }}">
|
<link rel="stylesheet" href="{{ $css.RelPermalink }}">
|
||||||
{{ with .Site.Params.favicon -}}
|
{{ with .Site.Params.favicon -}}
|
||||||
<link rel="shortcut icon" href="{{ . }}" type="image/x-icon">
|
<link rel="shortcut icon" href="{{ . }}" type="image/x-icon">
|
||||||
|
|
|
@ -46,6 +46,7 @@
|
||||||
packages = {
|
packages = {
|
||||||
inherit
|
inherit
|
||||||
(pkgs)
|
(pkgs)
|
||||||
|
e11sync-blog
|
||||||
e11sync-static
|
e11sync-static
|
||||||
e11sync-djangostatic
|
e11sync-djangostatic
|
||||||
e11sync-caddyfile
|
e11sync-caddyfile
|
||||||
|
|
|
@ -12,6 +12,7 @@ in {
|
||||||
geoip-mmdb = withDjango5.callPackage ./pkgs/geoip-mmdb.nix {
|
geoip-mmdb = withDjango5.callPackage ./pkgs/geoip-mmdb.nix {
|
||||||
inherit geoip2-tarball;
|
inherit geoip2-tarball;
|
||||||
};
|
};
|
||||||
|
e11sync-blog = withDjango5.callPackage ./pkgs/e11sync-blog.nix {};
|
||||||
e11sync-static = withDjango5.callPackage ./pkgs/e11sync-static.nix {};
|
e11sync-static = withDjango5.callPackage ./pkgs/e11sync-static.nix {};
|
||||||
e11sync-djangostatic = withDjango5.callPackage ./pkgs/e11sync-djangostatic.nix {};
|
e11sync-djangostatic = withDjango5.callPackage ./pkgs/e11sync-djangostatic.nix {};
|
||||||
e11sync-caddyfile = withDjango5.callPackage ./pkgs/e11sync-caddyfile.nix {};
|
e11sync-caddyfile = withDjango5.callPackage ./pkgs/e11sync-caddyfile.nix {};
|
||||||
|
|
|
@ -0,0 +1,19 @@
|
||||||
|
{
|
||||||
|
stdenv,
|
||||||
|
dart-sass,
|
||||||
|
hugo,
|
||||||
|
}:
|
||||||
|
stdenv.mkDerivation rec {
|
||||||
|
name = "e11sync-blog";
|
||||||
|
srcs = [../blog ../static];
|
||||||
|
nativeBuildInputs = [dart-sass];
|
||||||
|
sourceRoot = ".";
|
||||||
|
buildPhase = ''
|
||||||
|
cd blog
|
||||||
|
${hugo}/bin/hugo --printPathWarnings --panicOnWarning
|
||||||
|
'';
|
||||||
|
installPhase = ''
|
||||||
|
mkdir -p $out
|
||||||
|
mv public/{static,blog,contact} $out/
|
||||||
|
'';
|
||||||
|
}
|
|
@ -3,19 +3,39 @@
|
||||||
zopfli,
|
zopfli,
|
||||||
brotli,
|
brotli,
|
||||||
findutils,
|
findutils,
|
||||||
|
e11sync-blog,
|
||||||
e11sync-djangostatic,
|
e11sync-djangostatic,
|
||||||
}:
|
}:
|
||||||
runCommand "e11sync-static" {
|
runCommand "e11sync-static" {
|
||||||
src = e11sync-djangostatic;
|
srcs = [e11sync-djangostatic e11sync-blog];
|
||||||
nativeBuildInputs = [findutils];
|
nativeBuildInputs = [findutils];
|
||||||
|
sourceRoot = ".";
|
||||||
} ''
|
} ''
|
||||||
unpackPhase
|
unpackPhase
|
||||||
find e11sync-djangostatic \
|
|
||||||
|
# check that {e11sync-djangostatic,e11sync-blog/static/style.*.css
|
||||||
|
# is the same file
|
||||||
|
hash1=$(echo e11sync-djangostatic/static/style.*.css | sed 's;.*/;;' )
|
||||||
|
hash2=$(echo e11sync-blog/static/style.*.css | sed 's;.*/;;' )
|
||||||
|
|
||||||
|
if [ "$hash1" != "$hash2" ]; then
|
||||||
|
{
|
||||||
|
echo "style.*.css in blog and django do not match:"
|
||||||
|
ls e11sync-djangostatic/style/style.*.css
|
||||||
|
ls blog/style/style.*.css
|
||||||
|
} >&2
|
||||||
|
fi
|
||||||
|
|
||||||
|
mkdir -p $out
|
||||||
|
mv e11sync-djangostatic/* $out/
|
||||||
|
mv --no-clobber e11sync-blog/{static,blog,contact} $out/
|
||||||
|
|
||||||
|
find $out \
|
||||||
-name '*.css' -or \
|
-name '*.css' -or \
|
||||||
-name '*.js' -or \
|
-name '*.js' -or \
|
||||||
-name '*.svg' -or \
|
-name '*.svg' -or \
|
||||||
|
-name '*.html' -or \
|
||||||
-name '*.txt' | \
|
-name '*.txt' | \
|
||||||
tee >(xargs -n1 -P''$(nproc) ${zopfli}/bin/zopfli) | \
|
tee >(xargs -n1 -P''$(nproc) ${zopfli}/bin/zopfli) | \
|
||||||
xargs -n1 -P''$(nproc) ${brotli}/bin/brotli
|
xargs -n1 -P''$(nproc) ${brotli}/bin/brotli
|
||||||
mv e11sync-djangostatic $out
|
|
||||||
''
|
''
|
||||||
|
|
Loading…
Reference in New Issue