chore(share): basic integration of CSS

This commit is contained in:
Elian Doran 2025-06-08 23:12:09 +03:00
parent 881a015f68
commit 9469433143
No known key found for this signature in database
4 changed files with 15 additions and 2 deletions

View File

@ -18,6 +18,7 @@ import utils, { isDev, safeExtractMessageAndStackFromError } from "../services/u
import options from "../services/options.js";
import { t } from "i18next";
import shareThemeRoot from "@triliumnext/share-theme/templates/page.ejs";
import shareThemeCss from "@triliumnext/share-theme/styles.css";
import ejs from "ejs";
function getSharedSubTreeRoot(note: SNote): { note?: SNote; branch?: SBranch } {
@ -212,7 +213,10 @@ function register(router: Router) {
if (useDefaultView) {
console.log("Got share theme path", shareThemeRoot);
const ejsResult = ejs.render(shareThemeRoot, opts, {
const ejsResult = ejs.render(shareThemeRoot, {
shareThemeCss,
...opts
}, {
includer(originalPath, parsedPath: string) {
console.log("Path ", originalPath, parsedPath);
throw new Error("Hi");

View File

@ -33,3 +33,8 @@ declare module "@triliumnext/share-theme/*.ejs" {
const content: string;
export default content;
}
declare module "@triliumnext/share-theme/styles.css" {
const content: string;
export default content;
}

View File

@ -13,7 +13,8 @@
"test": "esrun src/scripts/test.ts"
},
"exports": {
"./*": "./src/*"
"./templates/*": "./src/templates/*",
"./*": "./dist/*"
},
"author": "",
"license": "ISC",

View File

@ -56,6 +56,9 @@ const customServerYml = `- url: "{protocol}://{domain}:{port}/etapi"
<% if (note.hasLabel("shareDisallowRobotIndexing")) { %>
<meta name="robots" content="noindex,follow" />
<% } %>
<style>
<%= shareThemeCss %>
</style>
<%
const pageTitle = `${note.title}${note.noteId !== subRoot.note.noteId ? ` - ${subRoot.note.title}` : ""}`;