TiddlyWiki / TiddlyWiki5

A self-contained JavaScript wiki for the browser, Node.js, AWS Lambda etc.
https://tiddlywiki.com/
Other
8.04k stars 1.19k forks source link

question about empty copy #4443

Closed 221V closed 4 years ago

221V commented 4 years ago

here i see link: https://tiddlywiki.com/#GettingStarted "Click here to download an empty copy of TiddlyWiki: Download Empty "

but there downloads 2.2 Mb html single file... this is not tiny

i'd like get tiny size html -- put css into css file, put js into js file, and get html file with data and html only... i do not know how do that with this 2.2 Mb html file

can you help me? thanks

pmario commented 4 years ago

TiddlyWiki html file contains the whole UI + app code, that is needed to create, modify and save the wiki. The js code is not minified, which makes it easier for ordinary users to read the code.

If you use a standard server to publish the wiki, the server is able to compress the file down to about 350kByte. So that's what goes over the wire.

If you compare 350kByte for a working single file wiki with 1 jpeg image of a modern mobile, it is tiny. Most mobiles produce 3-5 MByte jpeg images, which are already compressed. ...

So what did you expect?


If you want a tiny setting, just create a single file, like my-wiki.html and add this code.

<!doctype html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<link id="faviconLink" rel="shortcut icon" href="favicon.ico">
<link rel="stylesheet" href="your-css.css">
<title>My tiny wiki</title>
</head>
<body>
Hello There
</body>
</html>

Done, No js needed.

221V commented 4 years ago

i just ask advice, how to move js from tiddly wiki html to js file ...

pmario commented 4 years ago

Have a look here: https://tiddlywiki.com/#Using%20the%20external%20JavaScript%20template

221V commented 4 years ago

thanks!

i found in html code

&quot;$:/config/SaveWikiButton/Template&quot;: {
            &quot;title&quot;: &quot;$:/config/SaveWikiButton/Template&quot;,
            &quot;text&quot;: &quot;$:/core/save/all&quot;
        },

and change to

&quot;$:/config/SaveWikiButton/Template&quot;: {
            &quot;title&quot;: &quot;$:/config/SaveWikiButton/Template&quot;,
            &quot;text&quot;: &quot;$:/core/save/all-external-js&quot;
        },

now saved 89,7kb , good ) but where i can get js for js file?

dubiouscript commented 4 years ago

but where i can get js for js file?

the 'external java-script' template is

@ $:/core/templates/tiddlywiki5.js https://github.com/Jermolene/TiddlyWiki5/blob/master/core/templates/external-js/tiddlywiki.js.tid

221V commented 4 years ago

thank you, but i do not undestand, how make it work

221V commented 4 years ago

@dubiouscript , that not works((

ok, i install npm like in guide https://tiddlywiki.com/#Installing%20TiddlyWiki%20on%20Node.js

and i create wiki named "test1"

e@e:~/tiddlywiki$ tiddlywiki test1 --init server
Copied edition 'server' to test1
e@e:~/tiddlywiki$ tiddlywiki "root-tiddler=$:/core/save/all-external-js"

and i get test1 folder

ok, what next???

i look guides https://tiddlywiki.com/#Using%20the%20external%20JavaScript%20template and https://tiddlywiki.com/static/tiddlywiki.info%2520Files.html

and i edit my ~/tiddlywiki/test1/tiddlywiki.info to next

{
    "description": "Basic client-server edition",
    "plugins": [
        "tiddlywiki/tiddlyweb",
        "tiddlywiki/filesystem",
        "tiddlywiki/highlight"
    ],
    "themes": [
        "tiddlywiki/vanilla",
        "tiddlywiki/snowwhite"
    ],
    "build": {
        "index": [
            "--rendertiddler",
            "$:/core/save/all-external-js",
            "index.html",
            "text/plain"
        ],
        "static": [
            "--rendertiddler",
            "$:/core/templates/static.template.html",
            "static.html",
            "text/plain",
            "--rendertiddler",
            "$:/core/templates/alltiddlers.template.html",
            "alltiddlers.html",
            "text/plain",
            "--rendertiddlers",
            "[!is[system]]",
            "$:/core/templates/static.tiddler.html",
            "static",
            "text/plain",
            "--rendertiddler",
            "$:/core/templates/static.template.css",
            "static/static.css",
            "text/plain",
            "--rendertiddler",
            "$:/core/templates/static.template.js",
            "static/static.js",
            "text/plain"
        ]
    }
}

and after

e@e:~/tiddlywiki$ tiddlywiki test1 --build index
 syncer-server-filesystem: Dispatching 'save' task: $:/StoryList

i see in folder "output" only single html file! with 379kb size!

how??? how??? how get separated css, js and html for this one-page wiki???

dubiouscript commented 4 years ago

change the template as you did hear

https://github.com/Jermolene/TiddlyWiki5/issues/4443#issuecomment-582527123

but instead of $:/core/save/all-external-js i think you can use $:/core/templates/tiddlywiki5.js then the save will contain only the js file

i think this was the method i used ( it was a while ago) but still afaik it should work !

however i hosted the html , and js on an external resource and have not used the nodejs server (because i use some other method for https://github.com/Jermolene/TiddlyWiki5/issues/3946 hosting html locally )

still some method is required to serve the js file it is important that the path in the template ($:/core/save/all-external-js) must point to the correct path of the hosted js file !!! ($:/core/templates/tiddlywiki5.js <-- where ever this was saved / is served from )

221V commented 4 years ago

thank you, but i decide use MkDocs instead TiddlyWiki for my tasks

TiddlyWiki is so hard for use and non-lightweight for me (in default view)

i'd like work with MkDocs instead -- 15 minits for read docs and understand how to work with it :)

unlike TiddlyWiki -- few weeks and do not know how deal with it... and tiddly-dev says that 2Mb+ for empty page is okay

MkDocs is better for me, really better, i am sorry...