Skip to content

Commit

Permalink
Adding new documentation file placeholder to check github links, refa…
Browse files Browse the repository at this point in the history
…ctoring code
  • Loading branch information
kdybicz committed Mar 7, 2017
1 parent 7f40abf commit 82e0acf
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,15 +84,16 @@ It's copy of our example file `config.json.sample`. More or less it looks like:
| acl | - | String | Permission of S3 object. [See AWS ACL documentation](http://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/S3.html#putObject-property). |
| backup | - | Object | Backup original file setting. |
| | bucket | String | Destination bucket to override. If not supplied, it will use `bucket` setting. |
| | directory | String | Image directory path. When starts with `./` relative to the source, otherwise creates a new tree. |
| | directory | String | Image directory path. Supports relative and absolute paths. Mode retails in [DIRECTORY.md](doc/DIRECTORY.md/#directory) |
| | template | Object | Map representing pattern substitution pair. Mode retails in [DIRECTORY.md](doc/DIRECTORY.md/#template) |
| | prefix | String | Prepend filename prefix if supplied. |
| | suffix | String | Append filename suffix if supplied. |
| | acl | String | Permission of S3 object. [See AWS ACL documentation](http://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/S3.html#putObject-property). |
| reduce | - | Object | Reduce setting following fields. |
| | quality | Number | Determine reduced image quality ( only `JPG` ). |
| | jpegOptimizer | String | Determine optimiser that should be used `mozjpeg` (default) or `jpegoptim` ( only `JPG` ). |
| | bucket | String | Destination bucket to override. If not supplied, it will use `bucket` setting. |
| | directory | String | Image directory path. When starts with `./` relative to the source, otherwise creates a new tree. |
| | directory | String | Image directory path. Supports relative and absolute paths. Mode retails in [DIRECTORY.md](doc/DIRECTORY.md/#directory) |
| | prefix | String | Prepend filename prefix if supplied. |
| | suffix | String | Append filename suffix if supplied. |
| | acl | String | Permission of S3 object. [See AWS ACL documentation](http://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/S3.html#putObject-property). |
Expand All @@ -105,7 +106,8 @@ It's copy of our example file `config.json.sample`. More or less it looks like:
| | jpegOptimizer | String | Determine optimiser that should be used `mozjpeg` (default) or `jpegoptim` ( only `JPG` ). |
| | orientation | Boolean | Auto orientation if value is `true`. |
| | bucket | String | Destination bucket to override. If not supplied, it will use `bucket` setting. |
| | directory | String | Image directory path. When starts with `./` relative to the source, otherwise creates a new tree. |
| | directory | String | Image directory path. Supports relative and absolute paths. Mode retails in [DIRECTORY.md](doc/DIRECTORY.md/#directory) |
| | template | Object | Map representing pattern substitution pair. Mode retails in [DIRECTORY.md](doc/DIRECTORY.md/#template) |
| | prefix | String | Prepend filename prefix if supplied. |
| | suffix | String | Append filename suffix if supplied. |
| | acl | String | Permission of S3 object. [See AWS ACL documentation](http://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/S3.html#putObject-property). |
Expand Down
1 change: 1 addition & 0 deletions doc/DIRECTORY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Directory
4 changes: 2 additions & 2 deletions lib/ImageData.js
Original file line number Diff line number Diff line change
Expand Up @@ -174,15 +174,15 @@ class ImageData {
} else {
console.log( "Directory " + this.dirName + " didn't match template " + directory.template.pattern )
}
} else if ( typeof directory === "string" ) {
}
if ( typeof directory === "string" ) {
// ./X , ../X , . , ..
if ( directory.match(/^\.\.?\//) || directory.match(/^\.\.?$/) ) {
return path.join(this.dirName, directory, prefix + fileName + suffix + extension);
} else {
return path.join(directory, prefix + fileName + suffix + extension);
}
}

return path.join(this.dirName, prefix + fileName + suffix + extension);
}
}
Expand Down

0 comments on commit 82e0acf

Please sign in to comment.