> make a tiddler A with CSS other than than StyleSheet (or core > StyleSheets); > include it into the StyelSheet, change CSS in A. > > What happens: > CSS is not changed until I open the StyleSheet in editMode and close > it. Or restart TW.
This is a 'design weakness' of the current stylesheet handling. Because you can *nest* embedded CSS from other tiddlers, the Stylesheet definition is recursively retrieved, replacing the embedded [[TiddlerName]] references with their respective content. Only after all the content has been retrieved is the entire block handed to the brower and applied to the current rendered content. There is a TW core 'notification' mechanism that can automatically trigger a function whenever a given tiddler is changed. When [[StyleSheet]] is changed, it (and all the embedded CSS) is re- applied. However, as you noted, if a nested tiddler is changed, the notification for *StyleSheet* does not occur. Of course, there is a notification for the actual tiddler that was changed, but that tiddler has not been 'registered' with the core, so no side-effect CSS processing is triggered. To make nested tiddlers re-apply as you want, it would be necessary, during the recursive expansion of the CSS source, to collect the names of the all the tiddlers whose content is being embedded, and then register notifications for each of these tiddlers. One issue is that this could lead to a great deal of overhead processing if a lot of small CSS 'fragments' are used. Another potential problem is that, when switching themes, a lot of 'cleanup' work would be needed to *reset* the notifications on the currently used CSS tiddlers, before switching themes and then adding notifications for all the CSS tiddlers used by the new theme. Lastly, the lack of notifications for nested CSS tiddlers is, in general, only a minor problem that occurs while you are adjusting your CSS definitions. Once you have gotten the styles the way you want, it is unlikely that the StyleSheet (and nested CSS tiddlers it references) will be changing much at all. In any case, if you can live with a one-click *semi-manual* solution, you can put this bit of HTML into your document: <html><a href="javascript:;" onclick="story.switchTheme(config.options.txtTheme)">refresh styles</ a></html> It creates a 'command link' that, when clicked, forces the core to re- process the currently loaded systemTheme, which re-applies the StyleSheet (and, of course, any nested CSS it references). While not a totally automatic solution, it is just ONE click, and it does avoid having to 'touch' (edit/done) the [[StyleSheet]] just to apply the CSS changes made in another tiddler. enjoy, -e Eric Shulman TiddlyTools / ELS Design Studios -- You received this message because you are subscribed to the Google Groups "TiddlyWiki" group. To post to this group, send email to tiddlyw...@googlegroups.com. To unsubscribe from this group, send email to tiddlywiki+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/tiddlywiki?hl=en.