{"action":"created","issue":{"url":"https://api.github.com/repos/mcfly-io/generator-mcfly/issues/302","labels_url":"https://api.github.com/repos/mcfly-io/generator-mcfly/issues/302/labels{/name}","comments_url":"https://api.github.com/repos/mcfly-io/generator-mcfly/issues/302/comments","events_url":"https://api.github.com/repos/mcfly-io/generator-mcfly/issues/302/events","html_url":"https://github.com/mcfly-io/generator-mcfly/issues/302","id":121462760,"number":302,"title":"webpack task should be able to pass populated constants to webpack.config.js","user":{"login":"jagged3dge","id":3892333,"avatar_url":"https://avatars.githubusercontent.com/u/3892333?v=3","gravatar_id":"","url":"https://api.github.com/users/jagged3dge","html_url":"https://github.com/jagged3dge","followers_url":"https://api.github.com/users/jagged3dge/followers","following_url":"https://api.github.com/users/jagged3dge/following{/other_user}","gists_url":"https://api.github.com/users/jagged3dge/gists{/gist_id}","starred_url":"https://api.github.com/users/jagged3dge/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jagged3dge/subscriptions","organizations_url":"https://api.github.com/users/jagged3dge/orgs","repos_url":"https://api.github.com/users/jagged3dge/repos","events_url":"https://api.github.com/users/jagged3dge/events{/privacy}","received_events_url":"https://api.github.com/users/jagged3dge/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/mcfly-io/generator-mcfly/labels/bug","name":"bug","color":"fc2929"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":8,"created_at":"2015-12-10T11:25:14Z","updated_at":"2015-12-10T13:18:08Z","closed_at":null,"body":"Thanks for making this lovely generator :+1: \r\n\r\nI am trying to use the same service base with my web and an ionic/cordova mobile app. To that end, I generated a new `target` using `yo mcfly:target mobile --mobile` which created a new `index-mobile.html` file in the `client` folder.\r\n\r\nNow when I'm building the `mobile` target, I find that it's using the other `index.html` file instead of starting off of `index-mobile.html`. Is this by design? If so, what do I need to change to make it automatically use the `index-{{targetSuffix}}.html` file instead of the original `index.html`."},"comment":{"url":"https://api.github.com/repos/mcfly-io/generator-mcfly/issues/comments/163611752","html_url":"https://github.com/mcfly-io/generator-mcfly/issues/302#issuecomment-163611752","issue_url":"https://api.github.com/repos/mcfly-io/generator-mcfly/issues/302","id":163611752,"user":{"login":"jskrzypek","id":1513265,"avatar_url":"https://avatars.githubusercontent.com/u/1513265?v=3","gravatar_id":"","url":"https://api.github.com/users/jskrzypek","html_url":"https://github.com/jskrzypek","followers_url":"https://api.github.com/users/jskrzypek/followers","following_url":"https://api.github.com/users/jskrzypek/following{/other_user}","gists_url":"https://api.github.com/users/jskrzypek/gists{/gist_id}","starred_url":"https://api.github.com/users/jskrzypek/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jskrzypek/subscriptions","organizations_url":"https://api.github.com/users/jskrzypek/orgs","repos_url":"https://api.github.com/users/jskrzypek/repos","events_url":"https://api.github.com/users/jskrzypek/events{/privacy}","received_events_url":"https://api.github.com/users/jskrzypek/received_events","type":"User","site_admin":false},"created_at":"2015-12-10T13:18:08Z","updated_at":"2015-12-10T13:18:08Z","body":"Then in your `webpack.config.js` just make the following change to your `module.exports` to consume the passed constants and return the result:\r\n\r\n```js\r\n'use strict';\r\n\r\nvar path = require('path');\r\nvar webpack = require('webpack');\r\nvar helper = require('./gulp_tasks/common/helper');\r\n\r\nmodule.exports = function(constants) {\r\n    return {\r\n        cache: true,\r\n        ... config stuff that can use constants if needed ...,\r\n        plugins: [\r\n            ...,\r\n            new HtmlWebpackPlugin({\r\n                filename: '../index.html',\r\n                template: './client/index.html',\r\n                template: constants.html.src,\r\n                chunks: [\r\n                    'init',\r\n                    'vendor',\r\n                    'app'\r\n                ]\r\n            }),\r\n        ]\r\n    };\r\n};\r\n```"}}