{"action":"created","issue":{"url":"https://api.github.com/repos/floridoo/gulp-sourcemaps/issues/274","repository_url":"https://api.github.com/repos/floridoo/gulp-sourcemaps","labels_url":"https://api.github.com/repos/floridoo/gulp-sourcemaps/issues/274/labels{/name}","comments_url":"https://api.github.com/repos/floridoo/gulp-sourcemaps/issues/274/comments","events_url":"https://api.github.com/repos/floridoo/gulp-sourcemaps/issues/274/events","html_url":"https://github.com/floridoo/gulp-sourcemaps/issues/274","id":204148048,"number":274,"title":"Can the first argument in the mapSources function be the full, absolute file path?","user":{"login":"azaslavsky","id":3709945,"avatar_url":"https://avatars.githubusercontent.com/u/3709945?v=3","gravatar_id":"","url":"https://api.github.com/users/azaslavsky","html_url":"https://github.com/azaslavsky","followers_url":"https://api.github.com/users/azaslavsky/followers","following_url":"https://api.github.com/users/azaslavsky/following{/other_user}","gists_url":"https://api.github.com/users/azaslavsky/gists{/gist_id}","starred_url":"https://api.github.com/users/azaslavsky/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/azaslavsky/subscriptions","organizations_url":"https://api.github.com/users/azaslavsky/orgs","repos_url":"https://api.github.com/users/azaslavsky/repos","events_url":"https://api.github.com/users/azaslavsky/events{/privacy}","received_events_url":"https://api.github.com/users/azaslavsky/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2017-01-30T22:22:46Z","updated_at":"2017-01-30T22:31:01Z","closed_at":null,"body":"Currently, when I do this:\r\n\r\n```javascript\r\nreturn gulp.src(files)\r\n      .pipe(prettyError())\r\n      .pipe(sourcemaps.init())\r\n      /* plugins etc */\r\n      .pipe(sourcemaps.write('./', {\r\n        mapSources: function(sourcePath, index) {\r\n          console.log(sourcePath);\r\n          return files[index].replace(process.cwd(), '');\r\n        }\r\n      }))\r\n```\r\n\r\nThe logged \"sourcePath\" names end up being only the file name rather than the absolute file path (`thing.js` instead of `/Users/whatever/myProject/src/thing.js`).  The latter seems much more useful, especially in my case. where I have several different files in different directories all sharing the same name (`models/thing.js`, `views/thing.js`, etc)."},"comment":{"url":"https://api.github.com/repos/floridoo/gulp-sourcemaps/issues/comments/276213084","html_url":"https://github.com/floridoo/gulp-sourcemaps/issues/274#issuecomment-276213084","issue_url":"https://api.github.com/repos/floridoo/gulp-sourcemaps/issues/274","id":276213084,"user":{"login":"nmccready","id":583593,"avatar_url":"https://avatars.githubusercontent.com/u/583593?v=3","gravatar_id":"","url":"https://api.github.com/users/nmccready","html_url":"https://github.com/nmccready","followers_url":"https://api.github.com/users/nmccready/followers","following_url":"https://api.github.com/users/nmccready/following{/other_user}","gists_url":"https://api.github.com/users/nmccready/gists{/gist_id}","starred_url":"https://api.github.com/users/nmccready/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nmccready/subscriptions","organizations_url":"https://api.github.com/users/nmccready/orgs","repos_url":"https://api.github.com/users/nmccready/repos","events_url":"https://api.github.com/users/nmccready/events{/privacy}","received_events_url":"https://api.github.com/users/nmccready/received_events","type":"User","site_admin":false},"created_at":"2017-01-30T22:31:01Z","updated_at":"2017-01-30T22:31:01Z","body":"If `mapSources` is a function currently it does [this](https://github.com/floridoo/gulp-sourcemaps/blob/master/src/write/index.internals.js#L40) . \r\n\r\nHowever, file is in scope so I could just pass the file or get the absolute path for you. If it is file then you can do whatever you want. Callback `(sourcePath, file) =>` .\r\n \r\nRight [here](https://github.com/floridoo/gulp-sourcemaps/blob/master/src/write/index.internals.js#L57) absolute path is used and the cwd is then striped."}}
{"actor":{"display_login":"nmccready"}}