Skip to content
This repository has been archived by the owner on Apr 19, 2022. It is now read-only.

Commit

Permalink
Added --create
Browse files Browse the repository at this point in the history
  • Loading branch information
pwaldhauer committed Aug 2, 2014
1 parent a11dcc0 commit 89b154f
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 1 deletion.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ Most of the configuration is embedded in the JSON file, but there are some comma
- *--quiet*: Do not print anything to the console while processing
- *--open*: Open the generated file in your browser automatically (Only works on Mac OS because it uses the `open` command, I guess.)

You can use `daiquiri -c [json file]` to create a brand new and empty JSON file.

## The magical JSON file

The format of the JSON file is quite self-explanatory. Currently all fields you see in the following example are mandatory.
Expand Down
13 changes: 12 additions & 1 deletion app.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,14 @@
var _ = require('underscore');
var async = require('async');
var path = require('path');
var ncp = require('ncp').ncp;

var argv = require('yargs')
.usage('Usage: $0 [path-to-json]')
.demand(1)
.boolean('c')
.alias('c', 'create')
.describe('c', 'Create a new and empty JSON file')
.boolean('f')
.alias('f', 'force-images')
.describe('f', 'Force regeneration of all images')
Expand All @@ -18,9 +22,16 @@ var argv = require('yargs')
.describe('j', 'Automatically open output file')
.argv;

if(argv.c) {
ncp(__dirname + '/template/default.json', path.resolve(argv._[0]), function (err) {
process.exit(0);
});

return;
}

var GalleryTool = require(__dirname + '/lib/GalleryTool');
var json = require(path.resolve(argv._[0]));

(new GalleryTool(json, argv)).render(function() {

});
39 changes: 39 additions & 0 deletions template/default.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"meta": {
"title": {
"headline": "Your Headline",
"subtitle": "Your Subtitle",
"author": {
"name": "John Smith",
"url": "http://example.com"
},
"media": [
"title-image"
]
},
"input": {
"prefix": "../path/to/files/IMG_",
"suffix": ".jpg"
},
"output": {
"template": "default",
"prefix": "prefix/",
"image_prefix": "images/",
"file": "index.html",
"url": "http://example.com/daiquiris/",
"quality_main": 87,
"quality_retina": 78,
"quality_lowres": 10
},
"layout": {
"big_width": 1024,
"full_width": 1400,
"grid_columns": 3,
"grid_spacing": 10,
"create_retina": true
}
},
"sections": [

]
}

0 comments on commit 89b154f

Please sign in to comment.