Skip to content

Commit

Permalink
💊 Fixed broken image generator
Browse files Browse the repository at this point in the history
  • Loading branch information
fboes committed Jan 18, 2018
1 parent 9289b9c commit 10eb53c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ Change log

For detailed information check [Blogophon's releases on Github](https://github.com/fboes/blogophon/releases).

1.4.2
-----

* :pill: Fixed broken image generator

1.4.1
-----

Expand Down
8 changes: 5 additions & 3 deletions lib/generator.js
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ const Generator = function(config) {
}
// Target directory
let sourceDirectory = post.filename.replace(/\.md$/, '') + "/"; // Source directory
let sourceGlob = glob.sync(sourceDirectory + "(*.png|*.jpg|*.gif)");
let sourceGlob = glob.sync(sourceDirectory + "*.{png,jpg,gif}");
let sourceReg = new RegExp(sourceDirectory);
let imageStyles = sourceGlob ? post.getAllImagesWithStyleObject() : {};

Expand Down Expand Up @@ -238,8 +238,10 @@ const Generator = function(config) {
Promise
.all(promises)
.then(function() {
console.log("Copied "+promises.length+" attachment file(s)");
return resolve(promises.length);
if (promises.length > 0) {
console.log("Copied "+promises.length+" attachment file(s)");
return resolve(promises.length);
}
})
.catch(reject)
;
Expand Down

0 comments on commit 10eb53c

Please sign in to comment.