Skip to content

Commit d2de80f

Browse files
feat: new implementation option (#354)
1 parent d0db4f9 commit d2de80f

File tree

11 files changed

+1263
-1680
lines changed

11 files changed

+1263
-1680
lines changed

.github/workflows/nodejs.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ jobs:
4343
- name: Lint
4444
run: npm run lint
4545

46-
- name: Security audit
47-
run: npm run security
46+
# - name: Security audit
47+
# run: npm run security
4848

4949
- name: Check commit message
5050
uses: wagoid/commitlint-github-action@v1

README.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,18 @@ And run `webpack` via your preferred method.
4545

4646
## Options
4747

48+
| Name | Type | Default | Description |
49+
| :-------------------------------------: | :------------------: | :----------------------: | :----------------------------------------------- |
50+
| **[`lessOptions`](#lessoptions)** | `{Object\|Function}` | `{ relativeUrls: true }` | Options for Less. |
51+
| **[`prependData`](#prependdata)** | `{String\|Function}` | `undefined` | Prepends Less code before the actual entry file. |
52+
| **[`appendData`](#appenddata)** | `{String\|Function}` | `undefined` | Prepends Less code after the actual entry file. |
53+
| **[`sourceMap`](#sourcemap)** | `{Boolean}` | `compiler.devtool` | Enables/Disables generation of source maps. |
54+
| **[`implementation`](#implementation)** | `{Object}` | `less` | Setup Less implementation to use. |
55+
4856
### `lessOptions`
4957

5058
Type: `Object|Function`
59+
Default: `{ relativeUrls: true }`
5160

5261
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:
5362

@@ -299,6 +308,41 @@ module.exports = {
299308
};
300309
```
301310

311+
### `implementation`
312+
313+
Type: `Object`
314+
Default: `less`
315+
316+
> ⚠ less-loader compatible with Less version 3 only
317+
318+
The special `implementation` option determines which implementation of Less to use.
319+
The `implementation` options either accepts `less` as a module.
320+
This is useful if you want to use Less with a smaller version. Do not forget that then you must install your own version of Less.
321+
322+
For example, to use custom Less implementation, you'd pass:
323+
324+
```js
325+
module.exports = {
326+
module: {
327+
rules: [
328+
{
329+
test: /\.less$/,
330+
use: [
331+
'style-loader',
332+
'css-loader',
333+
{
334+
loader: 'less-loader',
335+
options: {
336+
implementation: require('less'),
337+
},
338+
},
339+
],
340+
},
341+
],
342+
},
343+
};
344+
```
345+
302346
## Examples
303347

304348
### Normal usage

0 commit comments

Comments
 (0)