|
| 1 | +### Table of Contents |
| 2 | + |
| 3 | +- [WebpackConfigHelpers](#webpackconfighelpers) |
| 4 | + - [webpack](#webpack) |
| 5 | + - [getLoaders](#getloaders) |
| 6 | + - [getRules](#getrules) |
| 7 | + - [getPlugins](#getplugins) |
| 8 | + - [getRulesByMatchingFile](#getrulesbymatchingfile) |
| 9 | + - [getLoadersByName](#getloadersbyname) |
| 10 | + - [getPluginsByName](#getpluginsbyname) |
| 11 | + - [getPluginsByType](#getpluginsbytype) |
| 12 | + - [setHtmlTemplate](#sethtmltemplate) |
| 13 | +- [PluginWrapper](#pluginwrapper) |
| 14 | +- [RuleWrapper](#rulewrapper) |
| 15 | +- [LoaderWrapper](#loaderwrapper) |
| 16 | + |
| 17 | +## WebpackConfigHelpers |
| 18 | + |
| 19 | +WebpackConfigHelpers |
| 20 | + |
| 21 | +**Parameters** |
| 22 | + |
| 23 | +- `cwd` |
| 24 | + |
| 25 | +### webpack |
| 26 | + |
| 27 | +Webpack module used to create config. |
| 28 | + |
| 29 | +Returns **[object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** |
| 30 | + |
| 31 | +### getLoaders |
| 32 | + |
| 33 | +Returns wrapper around all loaders from config. |
| 34 | + |
| 35 | +**Parameters** |
| 36 | + |
| 37 | +- `config` **[object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** [webpack config](https://webpack.js.org/configuration/#options). |
| 38 | + |
| 39 | +Returns **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)<[LoaderWrapper](#loaderwrapper)>** |
| 40 | + |
| 41 | +### getRules |
| 42 | + |
| 43 | +Returns wrapper around all rules from config. |
| 44 | + |
| 45 | +**Parameters** |
| 46 | + |
| 47 | +- `config` **[object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** [webpack config](https://webpack.js.org/configuration/#options). |
| 48 | + |
| 49 | +Returns **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)<[RuleWrapper](#rulewrapper)>** |
| 50 | + |
| 51 | +### getPlugins |
| 52 | + |
| 53 | +Returns wrapper around all plugins from config. |
| 54 | + |
| 55 | +**Parameters** |
| 56 | + |
| 57 | +- `config` **[object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** [webpack config](https://webpack.js.org/configuration/#options). |
| 58 | + |
| 59 | +Returns **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)<[PluginWrapper](#pluginwrapper)>** |
| 60 | + |
| 61 | +### getRulesByMatchingFile |
| 62 | + |
| 63 | +**Parameters** |
| 64 | + |
| 65 | +- `config` **[object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** [webpack config](https://webpack.js.org/configuration/#options). |
| 66 | +- `file` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** path to test against loader. Resolved relatively to $PWD. |
| 67 | + |
| 68 | +Returns **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)<[RuleWrapper](#rulewrapper)>** |
| 69 | + |
| 70 | +### getLoadersByName |
| 71 | + |
| 72 | +Returns loaders that match provided name. |
| 73 | + |
| 74 | +**Parameters** |
| 75 | + |
| 76 | +- `config` **[object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** [webpack config](https://webpack.js.org/configuration/#options). |
| 77 | +- `name` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** name of loader. |
| 78 | + |
| 79 | +**Examples** |
| 80 | + |
| 81 | +```javascript |
| 82 | +helpers.getLoadersByName(config, 'less-loader') |
| 83 | +``` |
| 84 | + |
| 85 | +Returns **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)<[LoaderWrapper](#loaderwrapper)>** |
| 86 | + |
| 87 | +### getPluginsByName |
| 88 | + |
| 89 | +Returns plugins that match provided name. |
| 90 | + |
| 91 | +**Parameters** |
| 92 | + |
| 93 | +- `config` **[object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** [webpack config](https://webpack.js.org/configuration/#options). |
| 94 | +- `name` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** name of loader. |
| 95 | + |
| 96 | +**Examples** |
| 97 | + |
| 98 | +```javascript |
| 99 | +helpers.getPluginsByName(config, 'HtmlWebpackPlugin') |
| 100 | +``` |
| 101 | + |
| 102 | +Returns **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)<[PluginWrapper](#pluginwrapper)>** |
| 103 | + |
| 104 | +### getPluginsByType |
| 105 | + |
| 106 | +Returns plugins that match provided type. |
| 107 | + |
| 108 | +**Parameters** |
| 109 | + |
| 110 | +- `config` **[object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** [webpack config](https://webpack.js.org/configuration/#options). |
| 111 | +- `type` **any** type of plugin. |
| 112 | + |
| 113 | +**Examples** |
| 114 | + |
| 115 | +```javascript |
| 116 | +helpers.getPluginsByType(config, webpack.optimize.CommonsChunkPlugin) |
| 117 | +``` |
| 118 | + |
| 119 | +Returns **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)<[PluginWrapper](#pluginwrapper)>** |
| 120 | + |
| 121 | +### setHtmlTemplate |
| 122 | + |
| 123 | +Sets template used by HtmlWebpackPlugin. |
| 124 | + |
| 125 | +**Parameters** |
| 126 | + |
| 127 | +- `config` **[object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** [webpack config](https://webpack.js.org/configuration/#options). |
| 128 | +- `template` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** template path. See [HtmlWebpackPlugin docs](https://github.com/jantimon/html-webpack-plugin/blob/master/docs/template-option.md). |
| 129 | + |
| 130 | +## PluginWrapper |
| 131 | + |
| 132 | +Wrapper around webpack's [plugin](https://webpack.js.org/configuration/plugins/#plugins). |
| 133 | + |
| 134 | +Type: [object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) |
| 135 | + |
| 136 | +**Properties** |
| 137 | + |
| 138 | +- `plugin` **[object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** [plugin entry](https://webpack.js.org/configuration/plugins/#plugins). |
| 139 | +- `index` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** index of plugin in config. |
| 140 | + |
| 141 | +## RuleWrapper |
| 142 | + |
| 143 | +Wrapper around webpack's [rule](https://webpack.js.org/configuration/module/#module-rules). |
| 144 | + |
| 145 | +Type: [object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) |
| 146 | + |
| 147 | +**Properties** |
| 148 | + |
| 149 | +- `rule` **[object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** [rule entry](https://webpack.js.org/configuration/module/#module-rules). |
| 150 | +- `index` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** index of rule in config. |
| 151 | + |
| 152 | +## LoaderWrapper |
| 153 | + |
| 154 | +Wrapper around webpack's [loader entry](https://webpack.js.org/configuration/module/#useentry). |
| 155 | + |
| 156 | +Type: [object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) |
| 157 | + |
| 158 | +**Properties** |
| 159 | + |
| 160 | +- `rule` **[object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** [rule entry](https://webpack.js.org/configuration/module/#module-rules). |
| 161 | +- `ruleIndex` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** index of rule in config. |
| 162 | +- `loader` **[object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** [loader entry](https://webpack.js.org/configuration/module/#useentry). |
| 163 | +- `loaderIndex` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** index of loader in rule. |
0 commit comments