From 3635b2883ba5c8f1f07dd3a9cc746d611cbea9e0 Mon Sep 17 00:00:00 2001 From: Patrick Haney Date: Fri, 15 Jul 2016 14:55:35 -0400 Subject: [PATCH] Zoom option creates filenames with @2x, @3x, etc. More standardized naming convention (which also works nicely with InVision via Sync app). Also update Readme to mention that the suffix option will override multiple width options, creating only a single screenshot from the first width in the array. --- index.js | 4 ++-- readme.md | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/index.js b/index.js index e426abe..8978007 100644 --- a/index.js +++ b/index.js @@ -31,11 +31,11 @@ var browser = function (file, opts, cb) { if ( opts.suffix ){ dest = filename.replace('.html', '') + '-' + opts.suffix + '.' + opts.type; }else if ( opts.zoom > 1 ) { - dest = filename.replace('.html', '') + '-' + w + '-zoom-' + opts.zoom + '.' + opts.type; + dest = filename.replace('.html', '') + '-' + w + '@' + opts.zoom + 'x.' + opts.type; } else { dest = filename.replace('.html', '') + '-' + w + '.' + opts.type; } - + // Background problem under self-host server page.evaluate(function () { var style = document.createElement('style'); diff --git a/readme.md b/readme.md index c1d0578..e792995 100644 --- a/readme.md +++ b/readme.md @@ -112,7 +112,7 @@ Zoom level to set the phantom.js browser viewport. Can be used to take 2x, 3x, e Type: `String` Default: 'false' -A custom suffix for output file name, you can use -thumb, -shot, etc. And the output file will named source-file-name + custom-suffix. If no suffix set, will use default suffix. +A custom suffix for output file name, you can use -thumb, -shot, etc. And the output file will named source-file-name + custom-suffix. If no suffix set, will use default suffix. If `suffix` is set, only the first `width` option will be created. ## Demo