{"action":"created","issue":{"url":"https://api.github.com/repos/pgilad/gulp-sitemap/issues/12","repository_url":"https://api.github.com/repos/pgilad/gulp-sitemap","labels_url":"https://api.github.com/repos/pgilad/gulp-sitemap/issues/12/labels{/name}","comments_url":"https://api.github.com/repos/pgilad/gulp-sitemap/issues/12/comments","events_url":"https://api.github.com/repos/pgilad/gulp-sitemap/issues/12/events","html_url":"https://github.com/pgilad/gulp-sitemap/issues/12","id":152192545,"number":12,"title":"Feature request: get last modification time from git","user":{"login":"Frank3K","id":8014077,"avatar_url":"https://avatars.githubusercontent.com/u/8014077?v=3","gravatar_id":"","url":"https://api.github.com/users/Frank3K","html_url":"https://github.com/Frank3K","followers_url":"https://api.github.com/users/Frank3K/followers","following_url":"https://api.github.com/users/Frank3K/following{/other_user}","gists_url":"https://api.github.com/users/Frank3K/gists{/gist_id}","starred_url":"https://api.github.com/users/Frank3K/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Frank3K/subscriptions","organizations_url":"https://api.github.com/users/Frank3K/orgs","repos_url":"https://api.github.com/users/Frank3K/repos","events_url":"https://api.github.com/users/Frank3K/events{/privacy}","received_events_url":"https://api.github.com/users/Frank3K/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/pgilad/gulp-sitemap/labels/enhancement","name":"enhancement","color":"84b6eb"},{"url":"https://api.github.com/repos/pgilad/gulp-sitemap/labels/help%20wanted","name":"help wanted","color":"009800"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":9,"created_at":"2016-05-01T10:23:48Z","updated_at":"2016-05-05T01:50:05Z","closed_at":null,"body":"I think it would be a nice addition if the last modification time could be taken from the git log of the corresponding html-file. When using the default option, the last modification time is taken from the file itself (if I understand correctly). For git, this is by default the time the file was created or updated using `git pull`. Furthermore, when using beautifier like [gulp-jsbeautifier](https://github.com/tarunc/gulp-jsbeautifier) the modification date is updated upon beautification.\r\n\r\nOne can get the last modification time (in ISO-8601 notation) of a file (e.g. index.html) using the following git command:\r\n\r\n``` git\r\ngit log -1 --format=%cI index.html\r\n```\r\n\r\nUsing plugins like [gulp-git](https://github.com/stevelacy/gulp-git) this can be embedded in a plugin as follows (pseudo-code):\r\n\r\n``` js\r\n  var path = ....;\r\n  var cmd = 'log -1 --format=%cI ' + paths;\r\n  return git.exec({ args: cmd, cwd: cwd, quiet: true }, function(err, stdout){\r\n     if (!err && lastmod) {\r\n      var lastmod = stdout.trim();\r\n    }\r\n  });\r\n```"},"comment":{"url":"https://api.github.com/repos/pgilad/gulp-sitemap/issues/comments/217056617","html_url":"https://github.com/pgilad/gulp-sitemap/issues/12#issuecomment-217056617","issue_url":"https://api.github.com/repos/pgilad/gulp-sitemap/issues/12","id":217056617,"user":{"login":"alethea","id":4101392,"avatar_url":"https://avatars.githubusercontent.com/u/4101392?v=3","gravatar_id":"","url":"https://api.github.com/users/alethea","html_url":"https://github.com/alethea","followers_url":"https://api.github.com/users/alethea/followers","following_url":"https://api.github.com/users/alethea/following{/other_user}","gists_url":"https://api.github.com/users/alethea/gists{/gist_id}","starred_url":"https://api.github.com/users/alethea/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alethea/subscriptions","organizations_url":"https://api.github.com/users/alethea/orgs","repos_url":"https://api.github.com/users/alethea/repos","events_url":"https://api.github.com/users/alethea/events{/privacy}","received_events_url":"https://api.github.com/users/alethea/received_events","type":"User","site_admin":false},"created_at":"2016-05-05T01:50:05Z","updated_at":"2016-05-05T01:50:05Z","body":"@Frank3K: Hm, maybe make it sync, but still be a function?\r\n\r\n```javascript\r\n{\r\n  lastmod: function (file) {\r\n    var cmd = 'git log -n 1 --pretty=format:%cI  -- ' + file.relative Path;\r\n    return new Date(execSync(cmd));\r\n  }\r\n}\r\n```"}}