Commit 2b3f1677 authored by Isabella Skořepová's avatar Isabella Skořepová

Fix multiple bugs

1. Not building without build/theme directory (race condition)
2. Wrong defaults for contentdir
3. Other bugs caused by those. Fixes #32 and #33
parent c342269b
Pipeline #135 passed with stage
......@@ -2,6 +2,7 @@
var moment = require('moment');
var cli = require('cli');
var config = require('./sitegin/config');
var path = require('path');
cli.main(function(args, options) {
console.log(options);
......@@ -82,9 +83,12 @@ var sitegin = function(config) {
var chokidar = require('chokidar');
// article or theme reload
chokidar.watch([config.sourceDir,config.themeDir], {ignoreInitial: true})
var watches = [path.join(config.sourceDir,'articles'),config.themeDir];
console.log('Watching',watches,'for changes');
chokidar.watch(watches, {ignoreInitial: true})
.on('all', function(event, path) {
console.log('Content or theme changed. Rebuilding...');
console.log('Change event:',event,'on path:',path);
run();
})
......@@ -126,7 +130,7 @@ var copyStaticFiles = function(builddir, staticdir,themedir) {
var rendersass = function(builddir, themedir) {
// SASS
var sass = require('node-sass');
var fs = require('fs');
var fs = require('filendir');
sass.render ({file: themedir+'/sass/style.scss'},function(err, result) {
if(err === null) {
......
......@@ -13,7 +13,7 @@ var options = cli.parse({
uiport: [null, 'BrowserSync UI port', 'number', 'port+1'],
httpsonly: [null, 'Converts all http://ok1kvk.cz links to https'],
httponly: [null, 'Converts all https://ok1kvk.cz links to http'],
contentdir: [null, 'Allows to specify arbitrary content directory.', 'string', 'static'],
contentdir: [null, 'Allows to specify arbitrary content directory.', 'string', 'content'],
themedir: [null, 'Allows to specify arbitrary content directory.', 'string', 'theme'],
builddir: [null, 'Allows to specify arbitrary content directory.', 'string', null],
staticdir: [null, 'Allows to specify arbitrary directory for static files.', 'string', 'static']
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment