update css pipeline

This commit is contained in:
f0x 2021-09-10 23:27:17 +02:00
commit c5917392c3
5 changed files with 21 additions and 11 deletions

1
web/assets/colors.css Normal file
View file

@ -0,0 +1 @@

View file

@ -63,7 +63,7 @@ main {
grid-column: span 3; grid-column: span 3;
display: grid; display: grid;
grid-template-columns: 50% 50%; grid-template-columns: 50% 50%;
grid-auto-rows: 16rem; grid-auto-rows: 10rem;
overflow: hidden; overflow: hidden;
gap: 0.3rem; gap: 0.3rem;
} }
@ -108,7 +108,7 @@ main {
grid-column: span 2; grid-column: span 2;
} }
.toot .media.odd a:first-child { .toot .media.odd a:first-child, .toot .media.double a {
grid-row: span 2; grid-row: span 2;
} }

View file

@ -46,17 +46,26 @@ let buildDir = process.env.BUILD_DIR;
if (buildDir == undefined) { if (buildDir == undefined) {
buildDir = `${__dirname}/build`; buildDir = `${__dirname}/build`;
} }
console.log("bundling to", buildDir);
if (process.env.NODE_ENV != "development") { function bundleAll() {
getTemplates().then((templates) => { return getTemplates().then((templates) => {
return Promise.map(templates, bundle); return Promise.map(templates, bundle);
}); });
}
if (process.env.NODE_ENV != "development") {
bundleAll();
} else { } else {
const chokidar = require("chokidar"); const chokidar = require("chokidar");
console.log("Watching for changes"); console.log("Watching for changes");
let watcher = chokidar.watch(`${__dirname}/templates`).on("all", (a) => { chokidar.watch(`${__dirname}/templates`).on("all", (_, path) => {
// bundle(); if (path.endsWith(".css")) {
console.log(a) bundle([path.split("/").slice(-1)[0], path]);
}
});
chokidar.watch(`${__dirname}/colors.css`).on("all", () => {
console.log("colors.css updated, rebuilding all templates");
bundleAll();
}); });
watcher.add(`${__dirname}/colors.css`);
} }

View file

@ -62,7 +62,7 @@ main {
grid-column: span 3; grid-column: span 3;
display: grid; display: grid;
grid-template-columns: 50% 50%; grid-template-columns: 50% 50%;
grid-auto-rows: 16rem; grid-auto-rows: 10rem;
overflow: hidden; overflow: hidden;
gap: 0.3rem; gap: 0.3rem;
@ -105,7 +105,7 @@ main {
grid-column: span 2; grid-column: span 2;
} }
&.odd a:first-child { &.odd a:first-child, &.double a {
grid-row: span 2; grid-row: span 2;
} }
} }

View file

@ -10,7 +10,7 @@
{{.Content |noescape}} {{.Content |noescape}}
</div> </div>
{{with .MediaAttachments}} {{with .MediaAttachments}}
<div class="media {{(len .) | oddOrEven }} {{if eq (len .) 1}}single{{end}}"> <div class="media {{(len .) | oddOrEven }}{{if eq (len .) 1}} single{{end}}{{if eq (len .) 2}} double{{end}}">
{{range .}} {{range .}}
<a href="{{.URL}}" target="_blank" title="{{.Description}}"> <a href="{{.URL}}" target="_blank" title="{{.Description}}">
{{if not .Description}} {{if not .Description}}