Start support for themes

To start with, we move the current stylesheets into a theme plugin
called "Snow White". Wikis have to specify at least one theme in their
`tiddlywiki.info` file. Next we'll add a mechanism for switching
between loaded themes
This commit is contained in:
Jeremy Ruston
2013-04-28 09:42:48 +01:00
parent d62c9f613c
commit 31a378b64c
13 changed files with 36 additions and 0 deletions
+11
View File
@@ -1086,6 +1086,16 @@ $tw.loadWikiTiddlers = function(wikiPath,parentPaths) {
}
}
}
// Load any themes listed in the wiki info file
if(wikiInfo.themes) {
var themesBasePath = path.resolve($tw.boot.corePath,$tw.config.themesPath);
for(var t=0; t<wikiInfo.themes.length; t++) {
pluginFields = $tw.loadPluginFolder(path.resolve(themesBasePath,"./" + wikiInfo.themes[t]));
if(pluginFields) {
$tw.wiki.addTiddler(pluginFields);
}
}
}
// Load the wiki files, registering them as writable
var resolvedWikiPath = path.resolve(wikiPath,$tw.config.wikiTiddlersSubDir);
$tw.utils.each($tw.loadTiddlersFromPath(resolvedWikiPath),function(tiddlerFile) {
@@ -1139,6 +1149,7 @@ $tw.boot.startup = function() {
},
config: { // Configuration overridables
pluginsPath: "../plugins/",
themesPath: "../themes/",
wikiInfo: "./tiddlywiki.info",
wikiPluginsSubDir: "./plugins",
wikiTiddlersSubDir: "./tiddlers",