This may be old hat for people more experienced than me with node and/or TW's CLI, but I hit something tonight that I thought I would post just in case it saves someone else the time to troubleshoot that it took me.
Scenario: I wanted to be able to serve my static files locally on my dev box after they are generated. I found node-static <https://github.com/cloudhead/node-static>, which has a nice CLI. Perfect. I figured if I was serving TW in edit mode off the default port 8080, I would want the static files served from 8081. So I did: npm install -g node-static ...and then from my TW project directory: static -p 8081 output/static ...and was able to browse to *http://localhost:8081/Home.html *successfully. Most excellent! I then tried to update my *genstatic.cmd *file to add that line after the *tiddlywiki *command, e.g.: tiddlywiki --rendertiddlers [!is[system]!tag[static]] $:/core/templates/static.tiddler.html static text/plain --rendertiddler $:/core/templates/static.template.css static/static.css text/plain --savetiddler favicon.ico static/favicon.ico --savetiddler Feed-icon.svg static/Feed-icon.svg --savetiddler .htaccess static/.htaccess --savetiddler googled49bf9dfd179fbc6 static/googled49bf9dfd179fbc6.html --output output/static --rendertiddler atomfeed atom.xml text/plain @rem The following requires node-static to be installed. @rem npm install -g node-static static -p 8081 output/static *Note: *Everything from *tiddlywiki *until the first *@rem *are on one line. But no matter what I tried, the TW command would run, and then the script would exit without invoking the *static *command. Frustrating. I then got an idea and used the *start *command to start TW in a second window: start tiddlywiki --rendertiddlers [!is[system]!tag[static]] $:/core/templates/static.tiddler.html static text/plain --rendertiddler $:/core/templates/static.template.css static/static.css text/plain --savetiddler favicon.ico static/favicon.ico --savetiddler Feed-icon.svg static/Feed-icon.svg --savetiddler .htaccess static/.htaccess --savetiddler googled49bf9dfd179fbc6 static/googled49bf9dfd179fbc6.html --output output/static --rendertiddler atomfeed atom.xml text/plain @rem The following requires node-static to be installed. @rem npm install -g node-static static -p 8081 output/static *Note: *Everything from *start *until the first *@rem *are on one line. This worked! TW would run in the second window and *static *would serve the files. I tried to use *start*'s */wait *parameter so *static *wouldn't run until there was something to serve, but I still had to manually close the second window that TW was running under, which was a pain. I also tried the */b *parameter, but that reverted to the old behavior (the script would exit after TW was done). Then I remember the old *&& *command chaining trick, and that worked. So now my script looks like this (especially note the part in *red*): @rem The following requires node-static to be installed. @rem npm install -g node-static tiddlywiki --rendertiddlers [!is[system]!tag[static]] $:/core/templates/static.tiddler.html static text/plain --rendertiddler $:/core/templates/static.template.css static/static.css text/plain --savetiddler favicon.ico static/favicon.ico --savetiddler Feed-icon.svg static/Feed-icon.svg --savetiddler .htaccess static/.htaccess --savetiddler googled49bf9dfd179fbc6 static/googled49bf9dfd179fbc6.html --output output/static --rendertiddler atomfeed atom.xml text/plain && static -p 8081 output/static *Note: *Everything from *tiddlywiki *until the end of the example are on one line. It's a nice way to be able to immediately test the static files and have them actually served instead of just clicking on files in the file system (which breaks things like "protocol-less" links, e.g., *href="//some.cdn.somewhere/resource"*). There are probably better ways of doing all this for those of you more experienced at all this than I, but in the mean time, I thought I would pass this along. Presumably the same technique would work under bash. -- 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 [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/tiddlywiki. For more options, visit https://groups.google.com/d/optout.

