{"action":"created","issue":{"url":"https://api.github.com/repos/ampedandwired/html-webpack-plugin/issues/182","labels_url":"https://api.github.com/repos/ampedandwired/html-webpack-plugin/issues/182/labels{/name}","comments_url":"https://api.github.com/repos/ampedandwired/html-webpack-plugin/issues/182/comments","events_url":"https://api.github.com/repos/ampedandwired/html-webpack-plugin/issues/182/events","html_url":"https://github.com/ampedandwired/html-webpack-plugin/issues/182","id":127484313,"number":182,"title":"lodash template parsing and html-loader","user":{"login":"joemaller","id":8320,"avatar_url":"https://avatars.githubusercontent.com/u/8320?v=3","gravatar_id":"","url":"https://api.github.com/users/joemaller","html_url":"https://github.com/joemaller","followers_url":"https://api.github.com/users/joemaller/followers","following_url":"https://api.github.com/users/joemaller/following{/other_user}","gists_url":"https://api.github.com/users/joemaller/gists{/gist_id}","starred_url":"https://api.github.com/users/joemaller/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joemaller/subscriptions","organizations_url":"https://api.github.com/users/joemaller/orgs","repos_url":"https://api.github.com/users/joemaller/repos","events_url":"https://api.github.com/users/joemaller/events{/privacy}","received_events_url":"https://api.github.com/users/joemaller/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-01-19T16:27:22Z","updated_at":"2016-01-19T18:58:26Z","closed_at":null,"body":"I know this has been touched on in other issues, but it would be useful if we could run html-loader on the  default lodash-template output. I know something like [underscore-template-loader](https://github.com/emaphp/underscore-template-loader) would work, but it seems silly to tack on another dependency which only duplicates functionality already present in html-webpack-plugin.\r\n\r\nA workaround I've been playing with is to use set the custom template to a basic HTML skeleton, then use a lodash/ejs include for the html. Something like this as a default template:\r\n\r\n```html\r\n<!doctype html>\r\n<html>\r\n  <head>\r\n    <title><%= htmlWebpackPlugin.options.title %></title>\r\n  </head>\r\n  <body>\r\n\r\n    <%= require('html!./content.html') %>\r\n\r\n  </body>\r\n</html>\r\n```\r\n\r\n...then `content.html` could include dependencies like images or whatever: \r\n\r\n```html\r\n<div>\r\n    <img src=\"./images/kittens.jpg\">\r\n</div>\r\n```\r\nWhile this seems to be working pretty well, it seems unnecessarily complex.\r\n\r\nAdding a more explicit option to the conditional on [line 488](https://github.com/ampedandwired/html-webpack-plugin/blob/d5c4e0845731389e7264b52df8fb8880ec5e651a/index.js#L488)  would be good to have. Something like a  `parseTemplate` boolean in the base config should be able to enable other loaders without affecting existing behavior. \r\n\r\nCurious about your thoughts before trying anything.\r\n"},"comment":{"url":"https://api.github.com/repos/ampedandwired/html-webpack-plugin/issues/comments/172951503","html_url":"https://github.com/ampedandwired/html-webpack-plugin/issues/182#issuecomment-172951503","issue_url":"https://api.github.com/repos/ampedandwired/html-webpack-plugin/issues/182","id":172951503,"user":{"login":"jantimon","id":4113649,"avatar_url":"https://avatars.githubusercontent.com/u/4113649?v=3","gravatar_id":"","url":"https://api.github.com/users/jantimon","html_url":"https://github.com/jantimon","followers_url":"https://api.github.com/users/jantimon/followers","following_url":"https://api.github.com/users/jantimon/following{/other_user}","gists_url":"https://api.github.com/users/jantimon/gists{/gist_id}","starred_url":"https://api.github.com/users/jantimon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jantimon/subscriptions","organizations_url":"https://api.github.com/users/jantimon/orgs","repos_url":"https://api.github.com/users/jantimon/repos","events_url":"https://api.github.com/users/jantimon/events{/privacy}","received_events_url":"https://api.github.com/users/jantimon/received_events","type":"User","site_admin":false},"created_at":"2016-01-19T18:58:26Z","updated_at":"2016-01-19T18:58:26Z","body":"@joemaller thx for your post. Combining lodash and html-loader is on my agenda right now.\r\nThe html loader uses regular expression to modify the template. This might cause serious issues when combined with template code. Just consider `<%= '<img src=\"' + x ? '1.png' : '2.png'\"> %>`.\r\n\r\nRight now I don't understand what you menat with adding a more explicit option as you are in full control:\r\n\r\nYou can specify a template e.g. 'my-fancy-template.html' and declare a html-loader (or any other loader) in your loader configuration.\r\nyou can also specify a loader directly e.g `{template: 'html!my-fancy-tempalte.jade'}`\r\nor you can just use the default template which will use underscore."}}