{"action":"created","issue":{"url":"https://api.github.com/repos/christophercliff/metalsmith-fingerprint/issues/8","labels_url":"https://api.github.com/repos/christophercliff/metalsmith-fingerprint/issues/8/labels{/name}","comments_url":"https://api.github.com/repos/christophercliff/metalsmith-fingerprint/issues/8/comments","events_url":"https://api.github.com/repos/christophercliff/metalsmith-fingerprint/issues/8/events","html_url":"https://github.com/christophercliff/metalsmith-fingerprint/pull/8","id":97941298,"number":8,"title":"normalize file paths","user":{"login":"oupala","id":13458743,"avatar_url":"https://avatars.githubusercontent.com/u/13458743?v=3","gravatar_id":"","url":"https://api.github.com/users/oupala","html_url":"https://github.com/oupala","followers_url":"https://api.github.com/users/oupala/followers","following_url":"https://api.github.com/users/oupala/following{/other_user}","gists_url":"https://api.github.com/users/oupala/gists{/gist_id}","starred_url":"https://api.github.com/users/oupala/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/oupala/subscriptions","organizations_url":"https://api.github.com/users/oupala/orgs","repos_url":"https://api.github.com/users/oupala/repos","events_url":"https://api.github.com/users/oupala/events{/privacy}","received_events_url":"https://api.github.com/users/oupala/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-07-29T13:54:19Z","updated_at":"2015-08-19T13:37:11Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/christophercliff/metalsmith-fingerprint/pulls/8","html_url":"https://github.com/christophercliff/metalsmith-fingerprint/pull/8","diff_url":"https://github.com/christophercliff/metalsmith-fingerprint/pull/8.diff","patch_url":"https://github.com/christophercliff/metalsmith-fingerprint/pull/8.patch"},"body":"normalize file path so that the plugin works on linux and windows (and hopefully macos X)\r\n\r\njust a try to fix issue #7"},"comment":{"url":"https://api.github.com/repos/christophercliff/metalsmith-fingerprint/issues/comments/132601088","html_url":"https://github.com/christophercliff/metalsmith-fingerprint/pull/8#issuecomment-132601088","issue_url":"https://api.github.com/repos/christophercliff/metalsmith-fingerprint/issues/8","id":132601088,"user":{"login":"oupala","id":13458743,"avatar_url":"https://avatars.githubusercontent.com/u/13458743?v=3","gravatar_id":"","url":"https://api.github.com/users/oupala","html_url":"https://github.com/oupala","followers_url":"https://api.github.com/users/oupala/followers","following_url":"https://api.github.com/users/oupala/following{/other_user}","gists_url":"https://api.github.com/users/oupala/gists{/gist_id}","starred_url":"https://api.github.com/users/oupala/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/oupala/subscriptions","organizations_url":"https://api.github.com/users/oupala/orgs","repos_url":"https://api.github.com/users/oupala/repos","events_url":"https://api.github.com/users/oupala/events{/privacy}","received_events_url":"https://api.github.com/users/oupala/received_events","type":"User","site_admin":false},"created_at":"2015-08-19T13:37:11Z","updated_at":"2015-08-19T13:37:11Z","body":"Nope, `path.normalize(p)` does not fix this.\r\n\r\nLet me explain it as clearly as I can.\r\n\r\nThis is what I have in my html :\r\n\r\n`<link href=\"/{{fingerprint.[css/app.css]}}\" rel=\"stylesheet\" type=\"text/css\" />`\r\n\r\nThis is what I have in metalsmith' metadata :\r\n\r\n`css\\app.css` (I think metalsmith automatically normalize the path on windows)\r\n\r\nThis is how it is modified by `path.normalize(p)` :\r\n\r\n`css\\app.css` (yes, it is not modified, but this is normal)\r\n\r\nThis is what is done by my pull request :\r\n\r\n`css/app.css` (this is what I want as on the web, we use slashes and not backslashes)\r\n\r\nIn fact, [path.normalize(p)](https://nodejs.org/api/path.html#path_path_normalize_p) is meant to normalize the path to the local system. It converts `\\` to `/` when running on linux and `/` to `\\` when running on windows (among other things.\r\n\r\nIn this case, I want to generate de **linux path** on a **windows system**, because the generated path will be written in the html file and the web is using `/` as common delimiter.\r\n\r\nThis is why I can't  use `path.normalize(p)` in my case.\r\n\r\nThis is also why I created the `unixp` variable so that we can have the real path of the css file `p` (with `/` on linux and `\\` on windows) and the path that will be written to the html file (**always with `/` whatever the system metalsmith is running on**).\r\n\r\nMy pull request is probably not optimal and can be improved, but it works as is.\r\n\r\nI hope my explanations were clear enough."}}