You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+44Lines changed: 44 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -53,6 +53,10 @@ Type: `Object|Function`
53
53
54
54
You can pass any Less specific options to the `less-loader` through the `lessOptions` property in the [loader options](https://webpack.js.org/configuration/module/#rule-options-rule-query). See the [Less documentation](http://lesscss.org/usage/#command-line-usage-options) for all available options in dash-case. Since we're passing these options to Less programmatically, you need to pass them in camelCase here:
55
55
56
+
#### `Object`
57
+
58
+
Use an object to pass options through to Less.
59
+
56
60
**webpack.config.js**
57
61
58
62
```js
@@ -84,6 +88,46 @@ module.exports = {
84
88
};
85
89
```
86
90
91
+
#### `Function`
92
+
93
+
Allows setting the options passed through to Less based off of the loader context.
94
+
95
+
```js
96
+
module.exports= {
97
+
module: {
98
+
rules: [
99
+
{
100
+
test:/\.less$/,
101
+
use: [
102
+
'style-loader',
103
+
'css-loader',
104
+
{
105
+
loader:'less-loader',
106
+
options: {
107
+
lessOptions: (loaderContext) => {
108
+
// More information about available properties https://webpack.js.org/api/loaders/
0 commit comments