Last active
August 29, 2015 13:59
-
-
Save sukima/10941302 to your computer and use it in GitHub Desktop.
Method for managing a dev and dist editions of a TiddlyWiki site using gulp.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"plugins": [ | |
"tiddlywiki/tiddlyweb", | |
"tiddlywiki/filesystem", | |
"tiddlywiki/codemirror", | |
"tiddlywiki/highlight" | |
], | |
"themes": [ | |
"tiddlywiki/vanilla", | |
"tiddlywiki/snowwhite" | |
] | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var gulp = require('gulp'); | |
var gutil = require('gulp-util'); | |
var scp = require('scp'); | |
var tiddlyWiki = require('tiddlywiki').TiddlyWiki; | |
// ./ | |
// ├── mainsite/ | |
// | ├── tiddlers ~> ../development/tiddlers | |
// | └── tiddlywiki.info | |
// └── development/ | |
// └── tiddlywiki.info | |
var editions = { | |
dist: './mainsite', | |
dev: './development' | |
}; | |
var distOutput = 'index.html'; | |
function runTiddlyWiki() { | |
var $tw = tiddlyWiki(); | |
$tw.boot.argv = Array.prototype.slice.call(arguments, 0); | |
$tw.boot.boot(); | |
} | |
gulp.task('dist', function() { | |
runTiddlyWiki(editions.dist, '--rendertiddler', '$:/core/save/all', distOutput, 'text/plain'); | |
}); | |
gulp.task('server', function() { | |
runTiddlyWiki(editions.dev, '--server'); | |
}); | |
gulp.task('deploy', ['dist'], function(done) { | |
scp.send({ | |
file: distOutput, | |
user: 'johndoe', | |
host: 'example.com', | |
path: 'path/to/www' | |
}, function(err, stdout, stderr) { | |
if (err) return done(err); | |
gutil.log('Deployed ' + gutil.colors.blue(distOutput)); | |
done(); | |
}); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"plugins": [ | |
"tiddlywiki/highlight" | |
], | |
"themes": [ | |
"tiddlywiki/vanilla", | |
"tiddlywiki/snowwhite" | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Updated for symlinking