Stylesheet tiddlers: A question of performance

95 views
Skip to first unread message

Mohammad Rahmani

unread,
Dec 17, 2020, 2:12:51 AM12/17/20
to tiddl...@googlegroups.com
Tiddlywiki is enough flexible to have

1. stylesheet tiddler of type text/css
2. stylesheet tiddler of type text/vnd.tiddlywiki    (good for dynamic css)
3. stylesheet as inline element using <style>..</style> html tag

Q1.
I normally use the first two types. What is the best practice to have a higher performance? Performance here means faster processing and what user sense is to have the fastest response!

Q2.
If I have to use dynamic styles, do you recommend having a  stylesheet tiddler of type text/vnd.tiddlywiki  with all css properties? OR you recommend to store all static CSS in a  text/css tiddler and ONLY put the dynamic part into another stylesheet tiddler of type text/vnd.tiddlywiki?



Best wishes
Mohammad

odin...@gmail.com

unread,
Dec 17, 2020, 4:36:50 AM12/17/20
to TiddlyWiki
Commenting on this because I am also curious to know what the differences are between 1 and 2 are.
Op donderdag 17 december 2020 om 08:12:51 UTC+1 schreef Mohammad:

Saq Imtiaz

unread,
Dec 17, 2020, 5:15:30 AM12/17/20
to TiddlyWiki
@Mohammad

Q1: #1 is faster than #2 but the difference shouldn't be significant unless you are using a large amount of wikitext in the stylesheet.
Also sometimes it is a choice between a dynamic stylesheet that use wikitext, vs other techniques to achieve the same thing. So the text/vnd.tiddlywiki type for the CSS might be the faster option overall.

Q2: It currently does not matter, as if any one stylesheet changes, the entire style tag for the document will be refreshed. However as expressed by Jeremy in the GH discussion on this topic, we might improve that to handle each stylesheet separately. So separating your dynamic and static CSS from now will mean less work later to take advantage of that eventual change. See https://github.com/Jermolene/TiddlyWiki5/discussions/5282#discussioncomment-207945

Mohammad Rahmani

unread,
Dec 17, 2020, 8:10:10 AM12/17/20
to tiddl...@googlegroups.com
Hi Saq,
 Many thanks for your clarification.

Best wishes
Mohammad


Best wishes
Mohammad


--
You received this message because you are subscribed to the Google Groups "TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tiddlywiki+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/3fd245c4-e441-49a6-9b3b-fcc892b44757n%40googlegroups.com.

TW Tones

unread,
Dec 18, 2020, 10:52:53 PM12/18/20
to TiddlyWiki
I would add to this discussion.
3. stylesheet as inline element using <style>..</style> html tag 
4. Define a CSS  class elsewhere and use the class field on the current tiddler to include it.

3, inline styles Should be avoided except for  quick test etc... or make sure you use selectors in the inline stylesheet definition otherwise the style sheet is applied to the whole wiki, but only ONLY when the tiddler is displayed, but there is not visible indicator where the inline style is used.

This can be very disruptive if you have many tiddlers open and suddenly you have erroneous css on your screen and you have to view the code or close tiddlers until you find the cause.

There should be a way to make such styles only apply within the current tiddler using the data tags etc... Perhaps the smartest way is to use the tiddlers CLASS FIELD and store the style definition in another tiddler. Since the class field is applied only to the tiddler in which it is used.

Regards
Tones
Reply all
Reply to author
Forward
0 new messages