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
|**[`minimize`](#minimize)**| `{Boolean|Object}` |在生产环境下为 `true`,否则为 `false`|告诉`html-loader`压缩 HTML |
59
+
|**[`esModule`](#esmodule)**|`{Boolean}`|`false`| 使用 ES 模块语法|
60
60
61
61
### `attributes` {#attributes}
62
62
63
-
Type:`Boolean|Object`
64
-
Default:`true`
63
+
类型:`Boolean|Object`
64
+
默认值:`true`
65
65
66
-
By default every loadable attributes (for example - `<img src="image.png">`) is imported (`const img = require('./image.png')`or`import img from "./image.png""`).
67
-
You may need to specify loaders for images in your configuration (recommended `file-loader`or`url-loader`).
For urls that start with a `/`, the default behavior is to not translate them.
359
-
If a `root`query parameter is set, however, it will be prepended to the url and then translated.
358
+
对于 `/` 开头的 url,默认不进行转换。
359
+
但是,如果设置了 `root`查询参数,它将被放在 URL 之前进行转换。
360
360
361
361
**webpack.config.js**
362
362
@@ -380,12 +380,12 @@ module.exports = {
380
380
381
381
### `preprocessor` {#preprocessor}
382
382
383
-
Type: `Function`
384
-
Default: `undefined`
383
+
类型:`Function`
384
+
默认值:`undefined`
385
385
386
-
Allows pre-processing of content before handling.
386
+
允许在处理之前对内容进行预处理。
387
387
388
-
> ⚠ You should always return valid HTML
388
+
> ⚠你应该始终返回有效的 HTML
389
389
390
390
**file.hbs**
391
391
@@ -398,7 +398,7 @@ Allows pre-processing of content before handling.
398
398
399
399
#### `Function` {#function}
400
400
401
-
You can set the `preprocessor`option as a `Function`instance.
401
+
你可以将 `preprocessor`选项设置为 `Function`实例。
402
402
403
403
**webpack.config.js**
404
404
@@ -435,9 +435,9 @@ module.exports = {
435
435
};
436
436
```
437
437
438
-
You can also set the `preprocessor`option as an asynchronous function instance.
438
+
你还可以将 `preprocessor`选项设置为异步函数实例。
439
439
440
-
For example:
440
+
例如:
441
441
442
442
**webpack.config.js**
443
443
@@ -476,14 +476,14 @@ module.exports = {
476
476
477
477
### `minimize` {#minimize}
478
478
479
-
Type: `Boolean|Object`
480
-
Default:`true`in production mode, otherwise`false`
479
+
类型:`Boolean|Object`
480
+
默认值:在生产模式下为`true`,否则为`false`
481
481
482
-
Tell`html-loader`to minimize HTML.
482
+
告诉`html-loader`编译时需要压缩 HTML 字符串。
483
483
484
484
#### `Boolean` {#boolean}
485
485
486
-
The enabled rules for minimizing by default are the following ones:
486
+
默认情况下,启用压缩的规则如下:
487
487
488
488
```js
489
489
({
@@ -522,9 +522,9 @@ module.exports = {
522
522
523
523
**webpack.config.js**
524
524
525
-
See[html-minifier-terser](https://github.com/DanielRuf/html-minifier-terser)'s documentation for more information on the available options.
The rules can be disabled using the following options in your `webpack.conf.js`
527
+
可以在 `webpack.conf.js` 中使用以下选项来禁用规则
528
528
529
529
**webpack.config.js**
530
530
@@ -549,13 +549,13 @@ module.exports = {
549
549
550
550
### `esModule` {#esmodule}
551
551
552
-
Type: `Boolean`
553
-
Default: `false`
552
+
类型:`Boolean`
553
+
值默认值:`false`
554
554
555
-
By default, `html-loader`generates JS modules that use the CommonJS modules syntax.
556
-
There are some cases in which using ES modules is beneficial, like in the case of [module concatenation](/plugins/module-concatenation-plugin/) and [tree shaking](/guides/tree-shaking/).
555
+
默认情况下, `html-loader`生成使用 CommonJS 模块语法的 JS 模块。
556
+
在某些情况下,使用 ES 模块会更好,例如在进行[模块合并](/plugins/module-concatenation-plugin/)和 [tree shaking](/guides/tree-shaking/) 时。
0 commit comments