Skip to content

Commit

Permalink
feat: new implementation option (#354)
Browse files Browse the repository at this point in the history
  • Loading branch information
evilebottnawi committed May 7, 2020
1 parent d0db4f9 commit d2de80f
Show file tree
Hide file tree
Showing 11 changed files with 1,263 additions and 1,680 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ jobs:
- name: Lint
run: npm run lint

- name: Security audit
run: npm run security
# - name: Security audit
# run: npm run security

- name: Check commit message
uses: wagoid/commitlint-github-action@v1
Expand Down
44 changes: 44 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,18 @@ And run `webpack` via your preferred method.

## Options

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

### `lessOptions`

Type: `Object|Function`
Default: `{ relativeUrls: true }`

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:

Expand Down Expand Up @@ -299,6 +308,41 @@ module.exports = {
};
```

### `implementation`

Type: `Object`
Default: `less`

> ⚠ less-loader compatible with Less version 3 only
The special `implementation` option determines which implementation of Less to use.
The `implementation` options either accepts `less` as a module.
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.

For example, to use custom Less implementation, you'd pass:

```js
module.exports = {
module: {
rules: [
{
test: /\.less$/,
use: [
'style-loader',
'css-loader',
{
loader: 'less-loader',
options: {
implementation: require('less'),
},
},
],
},
],
},
};
```

## Examples

### Normal usage
Expand Down
Loading

0 comments on commit d2de80f

Please sign in to comment.