{"action":"created","issue":{"url":"https://api.github.com/repos/ant-tool/atool-build/issues/120","repository_url":"https://api.github.com/repos/ant-tool/atool-build","labels_url":"https://api.github.com/repos/ant-tool/atool-build/issues/120/labels{/name}","comments_url":"https://api.github.com/repos/ant-tool/atool-build/issues/120/comments","events_url":"https://api.github.com/repos/ant-tool/atool-build/issues/120/events","html_url":"https://github.com/ant-tool/atool-build/issues/120","id":141243349,"number":120,"title":"feature request - modifyVars at custom config","user":{"login":"plandem","id":1381366,"avatar_url":"https://avatars.githubusercontent.com/u/1381366?v=3","gravatar_id":"","url":"https://api.github.com/users/plandem","html_url":"https://github.com/plandem","followers_url":"https://api.github.com/users/plandem/followers","following_url":"https://api.github.com/users/plandem/following{/other_user}","gists_url":"https://api.github.com/users/plandem/gists{/gist_id}","starred_url":"https://api.github.com/users/plandem/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/plandem/subscriptions","organizations_url":"https://api.github.com/users/plandem/orgs","repos_url":"https://api.github.com/users/plandem/repos","events_url":"https://api.github.com/users/plandem/events{/privacy}","received_events_url":"https://api.github.com/users/plandem/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-03-16T11:20:32Z","updated_at":"2016-03-16T20:45:26Z","closed_at":null,"body":"Looks like it's impossible to modify modifyVars, right now.\r\n```\r\nloader: _extractTextWebpackPlugin2.default.extract('css?sourceMap!' + 'postcss-loader!' + ('less?{\"sourceMap\":true,\"modifyVars\":' + JSON.stringify(pkg.theme || {}) + '}'))\r\n\r\n```\r\nSo looks like 'package.json' is the only way right now, but i need differ path for assets in dev and prod modes, so i would like to modify 'modifyVars' inside of custom webpack config.\r\n\r\ncase: differ path for assets in dev/prod modes\r\n\r\nit also will help to remove such hacks:\r\n\r\nindex.less\r\n```\r\n@import \"~antd/style/themes/default/index.less\";\r\n@import \"custom.less\";\r\n@import \"~antd/style/core/index.less\";\r\n```\r\n\r\ncustom.less\r\n```\r\n@assets-url: \"/assets/\";\r\n@icon-url: \"@{assets-url}/fonts/ant-font/ant-font\";\r\n@dash-type-url: \"@{assets-url}/images/dash-types\";\r\n@icon-type-url: \"@{assets-url}/images/dashboard-icons\";\r\n```\r\n\r\nin would like to do something like this case i could use modifyVars and set: \r\n```\r\n  webpackConfig.plugins.push(new webpack.DefinePlugin({\r\n    'theme':  {\r\n      'icon-url': 'assets/fonts/ant-font/ant-font',\r\n      'assets-url': 'assets'\r\n}\r\n  }));\r\n\r\n```\r\n\r\nnow i have to do it like this:\r\n```\r\n  var less_loader_id = null;\r\n\r\n  webpackConfig.module.loaders.forEach(function(loader, loader_i) {\r\n    if (loader.loader === 'babel') {\r\n      // https://github.com/ant-design/babel-plugin-antd\r\n      //loader.query.plugins.push('lodash');\r\n      loader.query.plugins.push('antd');\r\n    }\r\n\r\n    if(process.env.PRODUCTION && loader.test && loader.test.toString() === (/\\.less$/).toString() && loader.loader.indexOf('less?')) {\r\n      less_loader_id = loader_i;\r\n    }\r\n\r\n    return loader;\r\n  });\r\n\r\n  //modify assets path for production\r\n  if(less_loader_id !== null) {\r\n    var loader = webpackConfig.module.loaders[less_loader_id];\r\n    var query = loader.loader.substring(loader.loader.indexOf('less?') + 'less'.length);\r\n    query = loaderUtils.parseQuery(query);\r\n    query.modifyVars['access-url'] = '/admin/s/assets/';\r\n    loader.loader = loader.loader.substring(0, loader.loader.indexOf('less?') + 'less?'.length) + JSON.stringify(query);\r\n  }\r\n```"},"comment":{"url":"https://api.github.com/repos/ant-tool/atool-build/issues/comments/197540287","html_url":"https://github.com/ant-tool/atool-build/issues/120#issuecomment-197540287","issue_url":"https://api.github.com/repos/ant-tool/atool-build/issues/120","id":197540287,"user":{"login":"plandem","id":1381366,"avatar_url":"https://avatars.githubusercontent.com/u/1381366?v=3","gravatar_id":"","url":"https://api.github.com/users/plandem","html_url":"https://github.com/plandem","followers_url":"https://api.github.com/users/plandem/followers","following_url":"https://api.github.com/users/plandem/following{/other_user}","gists_url":"https://api.github.com/users/plandem/gists{/gist_id}","starred_url":"https://api.github.com/users/plandem/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/plandem/subscriptions","organizations_url":"https://api.github.com/users/plandem/orgs","repos_url":"https://api.github.com/users/plandem/repos","events_url":"https://api.github.com/users/plandem/events{/privacy}","received_events_url":"https://api.github.com/users/plandem/received_events","type":"User","site_admin":false},"created_at":"2016-03-16T20:45:26Z","updated_at":"2016-03-16T20:45:26Z","body":"to summarize - a way to provide theme via cli arg is more than enough:\r\n```\r\natool-build --theme dev.json\r\n```"}}