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

Allow to select static and content dir

parent 30a00925
No related branches found
No related tags found
No related merge requests found
......@@ -62,7 +62,7 @@ var sitegin = function(config) {
console.log('Sitegin successfully loaded');
run();
copyStaticFiles(config.builddir);
copyStaticFiles(config.builddir, config.staticDir);
rendersass(config.builddir);
if(!options.noserver) {
......@@ -82,7 +82,7 @@ var sitegin = function(config) {
var chokidar = require('chokidar');
// article or theme reload
chokidar.watch(['content/','theme/'], {ignoreInitial: true})
chokidar.watch([config.sourceDir,'theme/'], {ignoreInitial: true})
.on('all', function(event, path) {
console.log('Content or theme changed. Rebuilding...');
run();
......@@ -101,17 +101,17 @@ var sitegin = function(config) {
});
}
var copyStaticFiles = function(builddir) {
var copyStaticFiles = function(builddir, staticdir) {
// STATIC FILES
var fsextra = require('node-fs-extra');
fsextra.copy(
'static',
staticdir,
builddir,
function(file){ return !(file.match('.git') || file.match('static/articles')); },
function(){console.log('copy static done');}
);
fsextra.copy(
'static/articles',
staticdir+'/articles',
builddir+'/clanek',
function(){console.log('copy static/articles done');}
);
......
......@@ -5,13 +5,18 @@
* (or write config reader which would replace this file - I'd appreciate
* merge request for this feature ;) )
*/
var Git = require('nodegit');
var cli = require('cli');
var options = cli.parse({
noserver: ['n', 'Dont run server'],
port: ['p', 'Port on which server should run', 'number', 1337],
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']
httponly: [null, 'Converts all https://ok1kvk.cz links to http'],
contentdir: [null, 'Allows to specify arbitrary content directory. '+
'Can also be http(s) url to zip file.', 'string', 'content'],
staticdir: [null, 'Allows to specify arbitrary directory for static files. '+
'Can also be http(s) url to zip file.', 'string', 'static']
});
module.exports = function() {
......@@ -22,14 +27,18 @@ module.exports = function() {
options.uiport = options.port+1;
}
return Promise.resolve({
config: {
options: options,
builddir: builddir,
sourceDir: 'content',
articlesLocation: 'articles',
linksPerPage: 6
return new Promise(function(resolve, reject){
function doResolve() {
resolve({config: {
options: options,
builddir: builddir,
sourceDir: options.contentdir,
staticDir: options.staticdir,
articlesLocation: 'articles',
linksPerPage: 6
}});
}
doResolve();
})
}
module.exports.watch = !options.noserver;
......@@ -5,18 +5,6 @@ then
read -s LFTP_PASSWORD; export LFTP_PASSWORD
fi
rm -rf build
mkdir -p build/theme
time node index.js --noserver
RET=$?
echo "Site compilation ended with status code $RET"
if [ $RET -ne 0 ]
then
echo "Error detected. Exitting."
exit 1
fi
chmod a+X build -R
USER=ok1kvk.cz-www-nove
HOST=krios.blueboard.cz
MAX_RETRIES=2
......@@ -49,5 +37,5 @@ else
RET=$?
echo "LFTP finished with return code $RET"
fi
exit $RET
exit 0
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