Skip to content
Snippets Groups Projects
Verified Commit 2b3f1677 authored by Isabella Skořepová's avatar Isabella Skořepová
Browse files

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
No related branches found
No related tags found
No related merge requests found
......@@ -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) {
......
......@@ -12,6 +12,7 @@
"browser-sync": "^2.11.1",
"chokidar": "^1.4.3",
"cli": "^0.11.2",
"filendir": "^1.0.0",
"highlight.js": "^9.2.0",
"jsesc": "^1.0.0",
"marked": "^0.3.5",
......
......@@ -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']
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment