{"action":"created","issue":{"url":"https://api.github.com/repos/assemble/assemble/issues/798","labels_url":"https://api.github.com/repos/assemble/assemble/issues/798/labels{/name}","comments_url":"https://api.github.com/repos/assemble/assemble/issues/798/comments","events_url":"https://api.github.com/repos/assemble/assemble/issues/798/events","html_url":"https://github.com/assemble/assemble/issues/798","id":124420991,"number":798,"title":"Including sub-directories with assets","user":{"login":"stefanwalther","id":669728,"avatar_url":"https://avatars.githubusercontent.com/u/669728?v=3","gravatar_id":"","url":"https://api.github.com/users/stefanwalther","html_url":"https://github.com/stefanwalther","followers_url":"https://api.github.com/users/stefanwalther/followers","following_url":"https://api.github.com/users/stefanwalther/following{/other_user}","gists_url":"https://api.github.com/users/stefanwalther/gists{/gist_id}","starred_url":"https://api.github.com/users/stefanwalther/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stefanwalther/subscriptions","organizations_url":"https://api.github.com/users/stefanwalther/orgs","repos_url":"https://api.github.com/users/stefanwalther/repos","events_url":"https://api.github.com/users/stefanwalther/events{/privacy}","received_events_url":"https://api.github.com/users/stefanwalther/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-12-31T01:28:36Z","updated_at":"2016-01-04T15:28:21Z","closed_at":null,"body":"Hi,\r\n\r\nI am having in one of my projects the following structure:\r\n\r\n```\r\n| articles-collection\r\n|── article-1\r\n    |── images\r\n           | a.png\r\n           | b.png\r\n    index.md\r\n|── article-2\r\n    |── images\r\n           | y.png\r\n           | z.png\r\n    index.md\r\n```\r\n\r\nHow would you approach that? Rendering the .md files is fine, but I want to include also the images in the sub-dir.\r\nUsing or writing a gulp-plugin like [gulp-add-src](https://github.com/urish/gulp-add-src) would not work, since then I'd get something like `Templates#render cannot find an engine for: .png`.\r\nSo I'd guess it would be some kind of middleware? What's the best event to hook into? Somewhere I have seen all the events I can hook into, but I cannot find them anymore.\r\nOr is the middleware approach wrong and I should choose something else?\r\n\r\n**Update:**\r\nRight now I have solved it with a separate gulp-task, but I'd like to have it next to the task where I work on a specific collection, just to be clearer with dependencies.\r\n\r\nThx a lot in advance!\r\nRegards\r\nStefan\r\n\r\nP.S.: Just to answer the questions of the bot: Using the latest version of `assemble` ..."},"comment":{"url":"https://api.github.com/repos/assemble/assemble/issues/comments/168706058","html_url":"https://github.com/assemble/assemble/issues/798#issuecomment-168706058","issue_url":"https://api.github.com/repos/assemble/assemble/issues/798","id":168706058,"user":{"login":"jonschlinkert","id":383994,"avatar_url":"https://avatars.githubusercontent.com/u/383994?v=3","gravatar_id":"","url":"https://api.github.com/users/jonschlinkert","html_url":"https://github.com/jonschlinkert","followers_url":"https://api.github.com/users/jonschlinkert/followers","following_url":"https://api.github.com/users/jonschlinkert/following{/other_user}","gists_url":"https://api.github.com/users/jonschlinkert/gists{/gist_id}","starred_url":"https://api.github.com/users/jonschlinkert/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jonschlinkert/subscriptions","organizations_url":"https://api.github.com/users/jonschlinkert/orgs","repos_url":"https://api.github.com/users/jonschlinkert/repos","events_url":"https://api.github.com/users/jonschlinkert/events{/privacy}","received_events_url":"https://api.github.com/users/jonschlinkert/received_events","type":"User","site_admin":false},"created_at":"2016-01-04T15:28:21Z","updated_at":"2016-01-04T15:28:21Z","body":"hmm, I'm not sure if that would be a good general-purpose solution for this though. I think `png` is just a placeholder for any unknown file extension that might be in assets, and probably just needs to be passed through - so we can altogether avoid the need to create views. \r\n\r\nAlso the `renameKey` function would apply to all views in the collection, so maybe something more specific than `assets` would be needed.\r\n\r\nmaybe middleware? something like this:\r\n\r\n```js\r\nfunction rename(options) {\r\n  return function(file, next) {\r\n    // modify file paths\r\n    // (this is an arbitrary example)\r\n    file.base = options.base;\r\n    next();\r\n  };\r\n}\r\n\r\napp.postRender(/\\.png$/, rename({\r\n  dest: 'foo',\r\n  base: 'abc'\r\n}));\r\n\r\napp.postRender(/\\.txt$/, rename({\r\n  dest: 'bar',\r\n  base: 'def'\r\n}));\r\n\r\napp.postRender(/\\.hbs$/, rename({\r\n  dest: 'baz',\r\n  base: 'xyz'\r\n}));\r\n```"}}