{"action":"created","issue":{"url":"https://api.github.com/repos/jadejs/jade/issues/1556","labels_url":"https://api.github.com/repos/jadejs/jade/issues/1556/labels{/name}","comments_url":"https://api.github.com/repos/jadejs/jade/issues/1556/comments","events_url":"https://api.github.com/repos/jadejs/jade/issues/1556/events","html_url":"https://github.com/jadejs/jade/pull/1556","id":35738926,"number":1556,"title":"mixin precompilation","user":{"login":"jeromew","id":687842,"avatar_url":"https://avatars.githubusercontent.com/u/687842?v=3","gravatar_id":"","url":"https://api.github.com/users/jeromew","html_url":"https://github.com/jeromew","followers_url":"https://api.github.com/users/jeromew/followers","following_url":"https://api.github.com/users/jeromew/following{/other_user}","gists_url":"https://api.github.com/users/jeromew/gists{/gist_id}","starred_url":"https://api.github.com/users/jeromew/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jeromew/subscriptions","organizations_url":"https://api.github.com/users/jeromew/orgs","repos_url":"https://api.github.com/users/jeromew/repos","events_url":"https://api.github.com/users/jeromew/events{/privacy}","received_events_url":"https://api.github.com/users/jeromew/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/jadejs/jade/labels/mixin","name":"mixin","color":"0b02e1"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":9,"created_at":"2014-06-14T23:32:12Z","updated_at":"2015-01-21T10:13:24Z","closed_at":"2015-01-21T10:13:24Z","pull_request":{"url":"https://api.github.com/repos/jadejs/jade/pulls/1556","html_url":"https://github.com/jadejs/jade/pull/1556","diff_url":"https://github.com/jadejs/jade/pull/1556.diff","patch_url":"https://github.com/jadejs/jade/pull/1556.patch"},"body":"Hello,\r\n\r\nThis PR is hopefully an acceptable way to separate the compilation of the mixins from the compilation of the templates.\r\n\r\nIn other words, you can compile mixins once (as a bundle or one by one) and then the compilation of a template will not need to recompile all the mixins :-)\r\n\r\nI have used it for some time now and did not run into issues. All tests are passing.\r\n\r\nI think this might be a nice addition for the dynamic capabilities of jade \r\n - combined with the dynamic mixin calls\r\n - to allow for easier componentization of mixins (as npm modules for instance)\r\n\r\nTell me what you think.\r\n\r\nExample code:\r\n\r\nmixin.jade\r\n````\r\nmixin dynamic(world)\r\n | hello #{world}\r\n````\r\n\r\n template.jade\r\n````\r\n+dynamic(\"world\")\r\n````\r\n\r\nindex.js\r\n````\r\nvar jade = require('jade');\r\nvar locals = {\r\n  keepMixins: true,\r\n  jade_mixins: {}\r\n};\r\n\r\nvar mixin = jade.renderFile('mixin.jade', locals);\r\nvar html = jade.renderFile('template.jade', locals);\r\nconsole.log(html);\r\n````\r\n\r\n=> result\r\n````\r\nhello world\r\n````\r\n"},"comment":{"url":"https://api.github.com/repos/jadejs/jade/issues/comments/70813204","html_url":"https://github.com/jadejs/jade/pull/1556#issuecomment-70813204","issue_url":"https://api.github.com/repos/jadejs/jade/issues/1556","id":70813204,"user":{"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},"created_at":"2015-01-21T10:13:24Z","updated_at":"2015-01-21T10:13:24Z","body":"I plan to support something like this as part of 2.0.0 via some kind of `import foo from 'bar'` syntax along the same lines as ES6 modules.  Thanks for all the work that you've put into this."}}