less-loader
Advanced tools
Comparing version 10.2.0 to 11.0.0
{ | ||
"name": "less-loader", | ||
"version": "10.2.0", | ||
"version": "11.0.0", | ||
"description": "A Less loader for webpack. Compiles Less to CSS.", | ||
@@ -16,3 +16,3 @@ "license": "MIT", | ||
"engines": { | ||
"node": ">= 12.13.0" | ||
"node": ">= 14.15.0" | ||
}, | ||
@@ -51,17 +51,17 @@ "scripts": { | ||
"@babel/preset-env": "^7.14.7", | ||
"@commitlint/cli": "^13.1.0", | ||
"@commitlint/config-conventional": "^13.1.0", | ||
"@commitlint/cli": "^17.0.0", | ||
"@commitlint/config-conventional": "^17.0.0", | ||
"@webpack-contrib/eslint-config-webpack": "^3.0.0", | ||
"babel-jest": "^27.0.6", | ||
"babel-jest": "^28.1.0", | ||
"cross-env": "^7.0.3", | ||
"del": "^6.0.0", | ||
"del-cli": "^4.0.1", | ||
"eslint": "^7.30.0", | ||
"eslint": "^8.15.0", | ||
"eslint-config-prettier": "^8.3.0", | ||
"eslint-plugin-import": "^2.24.1", | ||
"husky": "^7.0.1", | ||
"jest": "^27.0.6", | ||
"husky": "^8.0.1", | ||
"jest": "^28.1.0", | ||
"less": "^4.1.1", | ||
"less-plugin-glob": "^3.0.0", | ||
"lint-staged": "^11.0.1", | ||
"lint-staged": "^12.4.1", | ||
"memfs": "^3.2.2", | ||
@@ -68,0 +68,0 @@ "npm-run-all": "^4.1.5", |
@@ -24,5 +24,17 @@ <div align="center"> | ||
```console | ||
$ npm install less less-loader --save-dev | ||
npm install less less-loader --save-dev | ||
``` | ||
or | ||
```console | ||
yarn add -D less less-loader | ||
``` | ||
or | ||
```console | ||
pnpm add -D less less-loader | ||
``` | ||
Then add the loader to your `webpack` config. For example: | ||
@@ -38,3 +50,3 @@ | ||
test: /\.less$/i, | ||
loader: [ | ||
use: [ | ||
// compiles Less to CSS | ||
@@ -55,13 +67,16 @@ "style-loader", | ||
| Name | Type | Default | Description | | ||
| :---------------------------------------: | :------------------: | :----------------------: | :----------------------------------------------------- | | ||
| **[`lessOptions`](#lessoptions)** | `{Object\|Function}` | `{ relativeUrls: true }` | Options for Less. | | ||
| **[`additionalData`](#additionalData)** | `{String\|Function}` | `undefined` | Prepends/Appends `Less` code to the actual entry file. | | ||
| **[`sourceMap`](#sourcemap)** | `{Boolean}` | `compiler.devtool` | Enables/Disables generation of source maps. | | ||
| **[`webpackImporter`](#webpackimporter)** | `{Boolean}` | `true` | Enables/Disables the default Webpack importer. | | ||
| **[`implementation`](#implementation)** | `{Object\|String}` | `less` | Setup Less implementation to use. | | ||
- **[`lessOptions`](#lessoptions)** | ||
- **[`additionalData`](#additionalData)** | ||
- **[`sourceMap`](#sourcemap)** | ||
- **[`webpackImporter`](#webpackimporter)** | ||
- **[`implementation`](#implementation)** | ||
### `lessOptions` | ||
Type: `Object|Function` | ||
Type: | ||
```ts | ||
type lessOptions = import('less').options | ((loaderContext: LoaderContext) => import('less').options}) | ||
``` | ||
Default: `{ relativeUrls: true }` | ||
@@ -71,3 +86,3 @@ | ||
#### `Object` | ||
#### `object` | ||
@@ -106,3 +121,3 @@ Use an object to pass options through to Less. | ||
#### `Function` | ||
#### `function` | ||
@@ -149,6 +164,13 @@ Allows setting the options passed through to Less based off of the loader context. | ||
Type: `String|Function` | ||
Type: | ||
```ts | ||
type additionalData = | ||
| string | ||
| ((content: string, loaderContext: LoaderContext) => string); | ||
``` | ||
Default: `undefined` | ||
Prepends `Less` code before the actual entry file. | ||
Prepends/Appends `Less` code to the actual entry file. | ||
In this case, the `less-loader` will not override the source but just **prepend** the entry's content. | ||
@@ -158,5 +180,5 @@ | ||
> ℹ Since you're injecting code, this will break the source mappings in your entry file. Often there's a simpler solution than this, like multiple Less entry files. | ||
> Since you're injecting code, this will break the source mappings in your entry file. Often there's a simpler solution than this, like multiple Less entry files. | ||
#### `String` | ||
#### `string` | ||
@@ -185,5 +207,5 @@ ```js | ||
#### `Function` | ||
#### `function` | ||
##### Sync | ||
##### `Sync` | ||
@@ -222,3 +244,3 @@ ```js | ||
##### Async | ||
##### `Async` | ||
@@ -259,3 +281,8 @@ ```js | ||
Type: `Boolean` | ||
Type: | ||
```ts | ||
type sourceMap = boolean; | ||
``` | ||
Default: depends on the `compiler.devtool` value | ||
@@ -296,3 +323,8 @@ | ||
Type: `Boolean` | ||
Type: | ||
```ts | ||
type webpackImporter = boolean; | ||
``` | ||
Default: `true` | ||
@@ -330,6 +362,10 @@ | ||
Type: `Object | String` | ||
Type: | ||
> ⚠ less-loader compatible with Less 3 and 4 versions | ||
```ts | ||
type implementation = object | string; | ||
``` | ||
> less-loader compatible with Less 3 and 4 versions | ||
The special `implementation` option determines which implementation of Less to use. Overrides the locally installed `peerDependency` version of `less`. | ||
@@ -339,3 +375,3 @@ | ||
#### Object | ||
#### `object` | ||
@@ -366,3 +402,3 @@ **webpack.config.js** | ||
#### String | ||
#### `string` | ||
@@ -596,3 +632,3 @@ **webpack.config.js** | ||
- [`extract-loader`](https://github.com/peerigon/extract-loader) (simpler, but specialized on the css-loader's output) | ||
- [MiniCssExtractPlugin](https://github.com/webpack-contrib/mini-css-extract-plugin) (more complex, but works in all use-cases) | ||
- [`MiniCssExtractPlugin`](https://github.com/webpack-contrib/mini-css-extract-plugin) (more complex, but works in all use-cases) | ||
@@ -599,0 +635,0 @@ ### CSS modules gotcha |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
648
32764