Assume you have some tiddlers contains CSS but NOT tagged with $:/tags/Stylesheet.
It is also possible to add more tiddlers (for example those added by
users), you can create a stylesheet by dynamic populating CSS from those
tiddlers.
As an example, we have three diffent tiddlers each have some CSS and tagged with exmp64 , to create a dynamic stylesheet create a tiddler as below
$:/tags/Stylesheet<$list filter="[tag[exmp64]]">
<$transclude/>
</$list>
Will be available in TW-Scripts
<$list filter="[tag[exmp64]]">
<$transclude/>
</$list>$:/tags/Stylesheet<$list filter="[tag[exmp64]]">
<$transclude/>
</$list>Including additional rules, that are wikified is difficult. .. You need to be sure, that it doesn't accidentally wikify CSS code. Since the browser CSS parser will silently fail.
<$list filter="[<button-state>] -[[false]]" variable=nul>
<$button tooltip="Toggle field $buttonname$ to false">
<$action-setfield $field=<<button-state-field>> $value="false"/>
<<button-true-label>>
</$button>
<style>
#$buttonname$-true { display: block; }
#$buttonname$-false { display: none; }
</style>
</$list><<button-here local-show Show Hide>>
<section id=local-show-true> I am on true </section>
RegardsTRonyCan we also apply CSS to a tiddler through viewtemplate?For example I want to apply certain CSS (like red border, special fonts) for tiddlers tagged with myTag and modified within last week!
Mario,Those solution uses CSS attribute selector! Here I need to add filters for example to filter tiddlers modified within last week!
<$list filter="[rank[species]]"> [data-tiddler-title^="<$view field=title format=text/>"] .tc-tiddler-body { column-count: 2; } </$list>The difference is the format=text attribute, which should also avoid problems with special tiddler titles.
have fun!
mario
IMO this is basically how native TW should create (aggregate) stylesheets,
<$list filter= ...format=text
Nothing is for free: "The more single tiddlers you have, the longer it will need to process them."
Dynamically generated styles have to be re-calculated everytime you change something.
PMario wrote:Nothing is for free: "The more single tiddlers you have, the longer it will need to process them."Good point. I wonder how much time are we talking about though.
Dynamically generated styles have to be re-calculated everytime you change something.Does "everytime I change something" mean "change anything" or does it mean only when I change tiddlers involved in the dynamic listing of them, i.e the stylesheets themselves?
Dynamically generated styles have to be re-calculated everytime you change something.Does "everytime I change something" mean "change anything" or does it mean only when I change tiddlers involved in the dynamic listing of them, i.e the stylesheets themselves?As far as I can remember, it's part of the refresh cycle. So really everytime the UI refreshes anything.
$:/tags/Stylesheet)slideshowslideshow tiddler has several child tiddlers (those tagged with slide + slideshow tiddler as parent)How is it possible to conditionally and dynamically apply CSS to a tiddler? Assume you have a child tiddler and you want to style it based on a theme filed value from parent.
[data-tiddler-title="the child"] {
{{fieldfromparent}}
}Mat, I did not get the point!Do you mean this way we can have fewer line in dynamic stylesheet?
The slideshow tiddler has a field called theme!