From 70568b347e2be730a8af5d7bc3b4afeb363c4bad Mon Sep 17 00:00:00 2001 From: Kenny Fernsten Date: Wed, 7 Sep 2016 16:07:52 -0600 Subject: [PATCH] Adding ability for DOMAIN option to be a callback function for more control over filename --- README.md | 1 + index.js | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 105941d..768566a 100644 --- a/README.md +++ b/README.md @@ -24,6 +24,7 @@ Include this in your gulp file: var opt = { // prefix domain in the `name` param when uploading a file. Leave blank to use the path // verbatim. Do not include a trailing slash. + // Also accepts callback function where filename is passed as single param, must return a string DOMAIN: '', API_URL: 'https://app.getsentry.com/api/0/projects/ORGANIZATION/PROJECT/', API_KEY: 'MY_LONG_API_KEY', diff --git a/index.js b/index.js index f109988..72f2e1f 100644 --- a/index.js +++ b/index.js @@ -88,7 +88,7 @@ module.exports = function (packageFile, opt) { filename: file.relative } }, - name: (opt.DOMAIN || '') + '/' + slash(file.relative) + name: opt.DOMAIN && opt.DOMAIN instanceof Function ? opt.DOMAIN(file.relative) : (opt.DOMAIN || '') + '/' + slash(file.relative) } }, cb); }