{"action":"created","issue":{"url":"https://api.github.com/repos/pugjs/pug/issues/2030","repository_url":"https://api.github.com/repos/pugjs/pug","labels_url":"https://api.github.com/repos/pugjs/pug/issues/2030/labels{/name}","comments_url":"https://api.github.com/repos/pugjs/pug/issues/2030/comments","events_url":"https://api.github.com/repos/pugjs/pug/issues/2030/events","html_url":"https://github.com/pugjs/pug/issues/2030","id":98634168,"number":2030,"title":"Possible solution to allowing dynamic include","user":{"login":"smaili","id":4451986,"avatar_url":"https://avatars.githubusercontent.com/u/4451986?v=3","gravatar_id":"","url":"https://api.github.com/users/smaili","html_url":"https://github.com/smaili","followers_url":"https://api.github.com/users/smaili/followers","following_url":"https://api.github.com/users/smaili/following{/other_user}","gists_url":"https://api.github.com/users/smaili/gists{/gist_id}","starred_url":"https://api.github.com/users/smaili/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/smaili/subscriptions","organizations_url":"https://api.github.com/users/smaili/orgs","repos_url":"https://api.github.com/users/smaili/repos","events_url":"https://api.github.com/users/smaili/events{/privacy}","received_events_url":"https://api.github.com/users/smaili/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/pugjs/pug/labels/includes","name":"includes","color":"49006E"}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/pugjs/pug/milestones/3","html_url":"https://github.com/pugjs/pug/milestones/3.0.0%20-%20Blocks%20and%20Mixins","labels_url":"https://api.github.com/repos/pugjs/pug/milestones/3/labels","id":1338096,"number":3,"title":"3.0.0 - Blocks and Mixins","description":"","creator":{"login":"ForbesLindesay","id":1260646,"avatar_url":"https://avatars.githubusercontent.com/u/1260646?v=3","gravatar_id":"","url":"https://api.github.com/users/ForbesLindesay","html_url":"https://github.com/ForbesLindesay","followers_url":"https://api.github.com/users/ForbesLindesay/followers","following_url":"https://api.github.com/users/ForbesLindesay/following{/other_user}","gists_url":"https://api.github.com/users/ForbesLindesay/gists{/gist_id}","starred_url":"https://api.github.com/users/ForbesLindesay/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ForbesLindesay/subscriptions","organizations_url":"https://api.github.com/users/ForbesLindesay/orgs","repos_url":"https://api.github.com/users/ForbesLindesay/repos","events_url":"https://api.github.com/users/ForbesLindesay/events{/privacy}","received_events_url":"https://api.github.com/users/ForbesLindesay/received_events","type":"User","site_admin":false},"open_issues":22,"closed_issues":1,"state":"open","created_at":"2015-10-05T12:27:56Z","updated_at":"2016-09-04T04:24:16Z","due_on":null,"closed_at":null},"comments":17,"created_at":"2015-08-02T20:18:14Z","updated_at":"2016-10-13T10:47:06Z","closed_at":null,"body":"There's so many issues that are open regarding this I honestly am not sure which one (if any) is the main/active one so I'm creating a new ticket that I hope may offer a solution :)\r\n\r\nAs I understand correctly, the reason for currently not having the ability for dynamic includes is due to compilation.  Assuming that is correct, I would like to propose allowing the use of dynamic include with the constraint that you must give some sort of compiler annotation that provides a list of all possible values of that dynamic include.\r\n\r\nFor example, say I have the template `main.jade`:\r\n\r\n```Jade\r\n//- main.jade\r\n-\r\n    var name = '';\r\n    if ( input === 'a' ) name = 'a';\r\n    else if ( input === 'b' ) name = 'b';\r\n    else if ( input === 'c' ) name = 'c';\r\n    else name = 'd';\r\n\r\ninclude /templates/#{ name }\r\n```\r\n\r\nIn order to let the compiler know all of the possible files that may be included, we just include some kind of special annotation.\r\n```Jade\r\n//- main.jade\r\n-\r\n    var name = '';\r\n    if ( input === 'a' ) name = 'a';\r\n    else if ( input === 'b' ) name = 'b';\r\n    else if ( input === 'c' ) name = 'c';\r\n    else name = 'd';\r\n\r\n//- Give the compiler key/value list of possible values for each variable used in the include\r\ninclude /templates/#{ name }//-{ name: [ 'a', 'b', 'c', 'd' ] }\r\n```"},"comment":{"url":"https://api.github.com/repos/pugjs/pug/issues/comments/253479625","html_url":"https://github.com/pugjs/pug/issues/2030#issuecomment-253479625","issue_url":"https://api.github.com/repos/pugjs/pug/issues/2030","id":253479625,"user":{"login":"hilleer","id":9430821,"avatar_url":"https://avatars.githubusercontent.com/u/9430821?v=3","gravatar_id":"","url":"https://api.github.com/users/hilleer","html_url":"https://github.com/hilleer","followers_url":"https://api.github.com/users/hilleer/followers","following_url":"https://api.github.com/users/hilleer/following{/other_user}","gists_url":"https://api.github.com/users/hilleer/gists{/gist_id}","starred_url":"https://api.github.com/users/hilleer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hilleer/subscriptions","organizations_url":"https://api.github.com/users/hilleer/orgs","repos_url":"https://api.github.com/users/hilleer/repos","events_url":"https://api.github.com/users/hilleer/events{/privacy}","received_events_url":"https://api.github.com/users/hilleer/received_events","type":"User","site_admin":false},"created_at":"2016-10-13T10:47:06Z","updated_at":"2016-10-13T10:47:06Z","body":"Is there any news on this issue? \r\n\r\nI have a similar case as many others, where I am iterating an array, and need to include a .md file for each array element. example:\r\n\r\nArray:\r\n`var list = ['category1', 'category2', 'category3'];`\r\n\r\n.Md files: \r\n```\r\npath/category1.md\r\npath/category2.md\r\npath/category3.md\r\n```\r\n\r\nSo I am using mixins, and want to do something like this, when iterating a mixin:\r\n```\r\nmixin category-card(category)\r\n\r\n   include:marked \"../public/md-files/\" + #{category} + \".md\"\r\n```\r\n\r\nI have checked soooo many of these issues, and yet found no solution. Is it supported yet, or is there any workarounds/plans of releasing such feature? :-) "}}
{"actor":{"display_login":"hilleer"}}