Skip to content

Commit

Permalink
Fix a bug where empty directories would be created
Browse files Browse the repository at this point in the history
  • Loading branch information
TimboKZ committed Nov 15, 2016
1 parent ae9f927 commit 50ef5bc
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
3 changes: 3 additions & 0 deletions dist/src/SiteBuilder.js
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,9 @@ var SiteBuilder = (function () {
for (var directoryName in directory.directories) {
if (directory.directories.hasOwnProperty(directoryName)) {
var directoryData = directory.directories[directoryName];
if (directoryData.files === {} && directoryData.directories === {}) {
continue;
}
var directoryArray = currentDirectoryArray.slice(0).concat([directoryName]);
var directoryPath = path.join.apply(undefined, directoryArray);
if (!Util_1.Util.createDirectory(path.join(this.buildPath, directoryPath))) {
Expand Down
6 changes: 5 additions & 1 deletion src/SiteBuilder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ export class SiteBuilder {
return undefined;
}
} else {
Util.debug('Assets folder does not exist, not copying any assets.')
Util.debug('Assets folder does not exist, not copying any assets.');
}
Util.debug('Generating site map . . . ');
if (!this.prepareMap()) {
Expand Down Expand Up @@ -274,6 +274,7 @@ export class SiteBuilder {
*
* This function also processes menus, updating relative links (if any) and marking current page as active
*
* @since 0.1.4 Now does not create directories if they have no children
* @since 0.1.0 Processes URLs in `pageUrls` and passes `url()` to Pug locals
* @since 0.1.0 Passes `buildHash` as `hash` to locals on every page
* @since 0.1.0 Passes `index` to locals, the absolute/relative URL to the index page
Expand Down Expand Up @@ -400,6 +401,9 @@ export class SiteBuilder {
for (let directoryName in directory.directories) {
if (directory.directories.hasOwnProperty(directoryName)) {
let directoryData = directory.directories[directoryName];
if(directoryData.files === {} && directoryData.directories === {}) {
continue;
}
let directoryArray = currentDirectoryArray.slice(0).concat([directoryName]);
let directoryPath = path.join.apply(undefined, directoryArray);
if (!Util.createDirectory(path.join(this.buildPath, directoryPath))) {
Expand Down

0 comments on commit 50ef5bc

Please sign in to comment.