Skip to content

Commit

Permalink
Fix up some default settings
Browse files Browse the repository at this point in the history
  • Loading branch information
webpro committed Mar 30, 2018
1 parent 5ad9832 commit 47a5df1
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
6 changes: 3 additions & 3 deletions bin/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,16 @@ program
.option(' --disable-auto-open', 'Disable auto-opening your web browser', defaults.disableAutoOpen)
.option(' --highlight-theme <theme>', `Highlight theme [${defaults.highlightTheme}]`, defaults.highlightTheme)
.option(' --host <host>', `Host [${defaults.host}]`, defaults.host)
.option(' --scripts <files>', 'Scripts to inject into the page', defaults.scripts)
.option(' --css <files>', 'CSS files to inject into the page', defaults.css)
.option(' --scripts <files>', 'Scripts to inject into the page')
.option(' --css <files>', 'CSS files to inject into the page')
.option(' --preprocessor <script>', 'Markdown preprocessor script', defaults.preprocessor)
.option(' --port <port>', `Port [${defaults.port}]`, defaults.port)
.option(' --print [filename]', 'Print', defaults.print)
.option('-t, --theme <theme>', `Theme [${defaults.theme}]`)
.option(' --title <title>', 'Title of the presentation')
.option('-s, --separator <separator>', 'Slide separator')
.option(' --static [dir]', 'Export static html to directory [_static]. Incompatible with --print.', defaults.static)
.option(' --static-dirs <dirs>', 'Extra directories to copy into static directory. Only used in conjunction with --static.', defaults.staticDirs)
.option(' --static-dirs <dirs>', 'Extra directories to copy into static directory. Only used in conjunction with --static.')
.option('-S, --vertical-separator <separator>', 'Vertical slide separator')
.option('-w, --watch', `Watch for changes in markdown file and livereload presentation [${defaults.watch}]`, defaults.watch)
.option(' --template <filename>', 'Template file for reveal.js', defaults.template)
Expand Down
6 changes: 3 additions & 3 deletions lib/defaults.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
"host": "localhost",
"scripts": [],
"css": [],
"preprocessor": false,
"preprocessor": null,
"port": 1948,
"print": false,
"revealOptions": {},
"template": "",
"listingTemplate": "",
"template": "template/reveal.html",
"listingTemplate": "template/listing.html",
"theme": "black",
"title": "reveal-md",
"separator": "\r?\n---\r?\n",
Expand Down
8 changes: 4 additions & 4 deletions lib/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ try {
debug('revealOptions %O', revealOptions);

defaults.base = '';
defaults.templatePath = path.join(__dirname, 'template', 'reveal.html');
defaults.revealBasePath = path.resolve(require.resolve('reveal.js'), '..', '..');
defaults.highlightThemePath = path.resolve(require.resolve('highlight.js'), '..', '..', 'styles');
defaults.templateListingPath = path.join(__dirname, 'template', 'listing.html');
defaults.templatePath = path.join(__dirname, defaults.template);
defaults.templateListingPath = path.join(__dirname, defaults.listingTemplate);
defaults.templateSlides = fs.readFileSync(defaults.templatePath).toString();
defaults.templateListing = () => fs.readFileSync(defaults.templateListingPath).toString();
defaults.revealOptionsStr = () => JSON.stringify(defaults.revealOptions);
Expand Down Expand Up @@ -99,10 +99,10 @@ function parseOptions(options) {
if (options.highlightTheme) {
options.highlightThemeUrl = '/css/highlight/' + options.highlightTheme + '.css';
}
if (options.template) {
if (options.template && options.template !== defaults.template) {
options.templateSlides = fs.readFileSync(options.template).toString();
}
if (options.listingTemplate) {
if (options.listingTemplate && options.listingTemplate !== defaults.listingTemplate) {
options.templateListing = fs.readFileSync(options.listingTemplate).toString();
}
if (options.revealOptions) {
Expand Down

0 comments on commit 47a5df1

Please sign in to comment.