Skip to content
This repository has been archived by the owner on Jun 23, 2023. It is now read-only.

Commit

Permalink
fix: build plain html
Browse files Browse the repository at this point in the history
  • Loading branch information
linonetwo committed Apr 5, 2022
1 parent d4e68d7 commit 29109c6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 43 deletions.
33 changes: 6 additions & 27 deletions demo/tiddlywiki.info
Original file line number Diff line number Diff line change
Expand Up @@ -9,32 +9,11 @@
],
"build": {
"index": [
"--rendertiddler",
"$:/plugins/tiddlywiki/tiddlyweb/save/offline",
"index.html",
"text/plain"
],
"externalimages": [
"--setfield",
"[is[binary]] [type[application/msword]]",
"_canonical_uri",
"$:/core/templates/canonical-uri-external-image",
"text/plain",
"--setfield",
"[is[binary]] [type[application/msword]]",
"text",
"",
"text/plain",
"--rendertiddler",
"$:/core/save/all-external-js",
"index.html",
"text/plain"
],
"externaljs": [
"--rendertiddler",
"$:/core/templates/tiddlywiki5.js",
"tiddlywiki5.js",
"text/plain"
]
"--savetiddlers","[tag[external-image]]","images",
"--rendertiddlers","[tag[external-text]]","$:/core/templates/tid-tiddler","text","text/plain",".tid",
"--setfield","[tag[external-image]]","_canonical_uri","$:/core/templates/canonical-uri-external-image","text/plain",
"--setfield","[tag[external-text]]","_canonical_uri","$:/core/templates/canonical-uri-external-text","text/plain",
"--setfield","[tag[external-image]] [tag[external-text]]","text","","text/plain",
"--rendertiddler","$:/core/save/all","index.html","text/plain"]
}
}
17 changes: 1 addition & 16 deletions scripts/build-demo-html.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,5 @@ await fs.copy(path.join(distDirectory, 'out', jsonPluginFileName), path.join(dis
/**
* Make demo html file
*/
const htmlPath = `${distDirectory}/output/index.html`;

/**
* Same as `cross-env TIDDLYWIKI_PLUGIN_PATH='node_modules/tiddlywiki/plugins/published' TIDDLYWIKI_THEME_PATH='${wikiFolderName}/themes'`
*
* But we don't need this, because we put the JSON plugin into the dist folder, it will be loaded automatically
*/
// process.env.TIDDLYWIKI_PLUGIN_PATH = `${distDir}/plugins`;

cd(distDirectory);
await $`tiddlywiki ${distDirectory} --build externalimages`;
await $`tiddlywiki ${distDirectory} --build externaljs`;
// build dll.js and config tw to load it
// original filename contains invalid char, will cause static server unable to load it
const htmlContent = fs.readFileSync(htmlPath, 'utf8');
const htmlContentWithCorrectJsPath = htmlContent.replaceAll('%24%3A%2Fcore%2Ftemplates%2Ftiddlywiki5.js', 'tiddlywiki5.js');
await fs.writeFile(htmlPath, htmlContentWithCorrectJsPath);
await $`tiddlywiki ${distDirectory} --build index`;

0 comments on commit 29109c6

Please sign in to comment.