{"action":"created","issue":{"url":"https://api.github.com/repos/jaketrent/html-webpack-template/issues/41","repository_url":"https://api.github.com/repos/jaketrent/html-webpack-template","labels_url":"https://api.github.com/repos/jaketrent/html-webpack-template/issues/41/labels{/name}","comments_url":"https://api.github.com/repos/jaketrent/html-webpack-template/issues/41/comments","events_url":"https://api.github.com/repos/jaketrent/html-webpack-template/issues/41/events","html_url":"https://github.com/jaketrent/html-webpack-template/pull/41","id":199593955,"number":41,"title":"[REQUEST]: Add support for a custom HTML blob.","user":{"login":"BrandonBoone","id":5246918,"avatar_url":"https://avatars.githubusercontent.com/u/5246918?v=3","gravatar_id":"","url":"https://api.github.com/users/BrandonBoone","html_url":"https://github.com/BrandonBoone","followers_url":"https://api.github.com/users/BrandonBoone/followers","following_url":"https://api.github.com/users/BrandonBoone/following{/other_user}","gists_url":"https://api.github.com/users/BrandonBoone/gists{/gist_id}","starred_url":"https://api.github.com/users/BrandonBoone/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BrandonBoone/subscriptions","organizations_url":"https://api.github.com/users/BrandonBoone/orgs","repos_url":"https://api.github.com/users/BrandonBoone/repos","events_url":"https://api.github.com/users/BrandonBoone/events{/privacy}","received_events_url":"https://api.github.com/users/BrandonBoone/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2017-01-09T16:16:38Z","updated_at":"2017-01-27T17:15:56Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/jaketrent/html-webpack-template/pulls/41","html_url":"https://github.com/jaketrent/html-webpack-template/pull/41","diff_url":"https://github.com/jaketrent/html-webpack-template/pull/41.diff","patch_url":"https://github.com/jaketrent/html-webpack-template/pull/41.patch"},"body":"My specific need is to use the generated `index.html` file as part of a server side rendering pipeline. Specifically, I'll need to bootstrap the page with JSON by replacing the text `{model}` in `<script type=\"application/json\">{model}</script>` with a JSON blob.\r\n\r\nMy first idea was to enhance the `scripts` option to give special attention to an object with a `content` property. While `content` would be an invalid script attribute, it may still cause a backwards comparability issue if someone were emitting it for some purpose.\r\n\r\n### Example 1\r\n```javascript\r\n\r\n{\r\n  scripts: [\r\n    {\r\n      id: 'customData',\r\n      type: 'application/json',\r\n      content: '{model}',\r\n    }\r\n  ],\r\n}\r\n\r\n```\r\n\r\n#### Generates\r\n\r\n```html\r\n<script id=\"customData\" type=\"application/json\">{model}</script>\r\n```\r\n\r\nYou could potentially maintain backwards comparability by detecting a special structure like:\r\n\r\n### Example 2\r\n\r\n```javascript\r\n\r\n{\r\n  scripts: [\r\n    {\r\n      attributes: {\r\n        id: 'customData',\r\n        type: 'application/json',\r\n      },\r\n      content: '{model}',\r\n    }\r\n  ],\r\n}\r\n\r\n``` \r\n\r\nIn order to avoid any backwards compatibility issues and to create an option that meets even more use cases, this pull request opts to go a much more generic route by simply allowing the user to define an open ended block of HTML as a string via a new option called `content`.\r\n\r\n### Example 3\r\n\r\n```javascript\r\n\r\n{\r\n  content: '<script id=\"customData\" type=\"application/json\">{model}</script>'\r\n}\r\n\r\n``` \r\n\r\nI placed it right below the rendered `appMountId` divs, but I could see this being controversial as it does cater to my specific use case and other users may want it rendered in different locations. I also realize you may not want to go this route as it deviates from the prescriptive/structured nature of the current template. Either way, I hope you understand the need and perhaps we can come up with a more ideal solution. Otherwise I can always customize it on my side. Thanks!"},"comment":{"url":"https://api.github.com/repos/jaketrent/html-webpack-template/issues/comments/275719904","html_url":"https://github.com/jaketrent/html-webpack-template/pull/41#issuecomment-275719904","issue_url":"https://api.github.com/repos/jaketrent/html-webpack-template/issues/41","id":275719904,"user":{"login":"jaketrent","id":552044,"avatar_url":"https://avatars.githubusercontent.com/u/552044?v=3","gravatar_id":"","url":"https://api.github.com/users/jaketrent","html_url":"https://github.com/jaketrent","followers_url":"https://api.github.com/users/jaketrent/followers","following_url":"https://api.github.com/users/jaketrent/following{/other_user}","gists_url":"https://api.github.com/users/jaketrent/gists{/gist_id}","starred_url":"https://api.github.com/users/jaketrent/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jaketrent/subscriptions","organizations_url":"https://api.github.com/users/jaketrent/orgs","repos_url":"https://api.github.com/users/jaketrent/repos","events_url":"https://api.github.com/users/jaketrent/events{/privacy}","received_events_url":"https://api.github.com/users/jaketrent/received_events","type":"User","site_admin":false},"created_at":"2017-01-27T17:15:56Z","updated_at":"2017-01-27T17:15:56Z","body":"Yeah, you're right: I'm not sure what to do with this feature. :)  If the user wants to create their own template, they can do that.  This template lib was initially to provide the few most common options that I needed in my template that didn't exist in the default.  As more people have used the project, the more use cases have been discovered for the cool projects people are building.  This feature almost brings it full circle, allowing the building of your own template within some subsection of the template.  \r\n\r\nFor this reason, I'm hesitating on adding it, because it detracts from what is perhaps the main reason to use this template: so you don't have to roll any html in your single page app project.\r\n\r\nBut for another reason -- providing an escape hatch to put *whatever* you want in this template that has other good things -- I'm tempted to add it.\r\n\r\nI'm interested, @BrandonBoone, after having this sit for a while, what are your current-day thoughts as they've evolved for a couple weeks?"}}
{"actor":{"display_login":"jaketrent"}}