Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions .eslintignore

This file was deleted.

4 changes: 0 additions & 4 deletions .eslintrc.js

This file was deleted.

45 changes: 20 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ Then add the plugin to your `webpack` configuration. For example:
**webpack.config.js**

```js
const HtmlMinimizerPlugin = require("html-minimizer-webpack-plugin");
const CopyPlugin = require("copy-webpack-plugin");
const HtmlMinimizerPlugin = require("html-minimizer-webpack-plugin");

module.exports = {
module: {
Expand Down Expand Up @@ -167,7 +167,7 @@ Finally, run `webpack` using the method you normally use (e.g., via CLI or an np
Type:

```ts
type test = string | RegExp | Array<string | RegExp>;
type test = string | RegExp | (string | RegExp)[];
```

Default: `/\.html(\?.*)?$/i`
Expand All @@ -192,7 +192,7 @@ module.exports = {
Type:

```ts
type include = string | RegExp | Array<string | RegExp>;
type include = string | RegExp | (string | RegExp)[];
```

Default: `undefined`
Expand All @@ -219,7 +219,7 @@ module.exports = {
Type:

```ts
type exclude = string | RegExp | Array<string | RegExp>;
type exclude = string | RegExp | (string | RegExp)[];
```

Default: `undefined`
Expand Down Expand Up @@ -306,20 +306,16 @@ Type:
```ts
type minify =
| ((
data: { [file: string]: string },
minimizerOptions: {
[key: string]: any;
},
data: Record<string, string>,
minimizerOptions: Record<string, any>,
) => {
code: string;
errors?: unknown[] | undefined;
warnings?: unknown[] | undefined;
})
| ((
data: { [file: string]: string },
minimizerOptions: {
[key: string]: any;
},
data: Record<string, string>,
minimizerOptions: Record<string, any>,
) => {
code: string;
errors?: unknown[] | undefined;
Expand Down Expand Up @@ -367,6 +363,7 @@ module.exports = {
},
minify: (data, minimizerOptions) => {
const htmlMinifier = require("html-minifier-terser");

const [[filename, input]] = Object.entries(data);

return {
Expand Down Expand Up @@ -411,7 +408,7 @@ module.exports = {
const [[filename, input]] = Object.entries(data);
// To do something
return {
code: `optimised code`,
code: "optimised code",
warnings: [],
errors: [],
};
Expand All @@ -428,17 +425,13 @@ module.exports = {
Type:

```ts
type minimizerOptions =
| {
[key: string]: any;
}
| Array<{
[key: string]: any;
}>;
type minimizerOptions = Record<string, any> | Record<string, any>[];
```

Default:

<!-- eslint-skip -->

```js
{
caseSensitive: true,
Expand Down Expand Up @@ -501,7 +494,7 @@ module.exports = {
const [[filename, input]] = Object.entries(data);
// To do something
return {
code: `optimised code`,
code: "optimised code",
warnings: [],
errors: [],
};
Expand All @@ -522,8 +515,8 @@ Available [`options`](https://github.com/swc-project/bindings/blob/main/packages
HTML Documents:

```js
const HtmlMinimizerPlugin = require("html-minimizer-webpack-plugin");
const CopyPlugin = require("copy-webpack-plugin");
const HtmlMinimizerPlugin = require("html-minimizer-webpack-plugin");

module.exports = {
module: {
Expand Down Expand Up @@ -563,9 +556,9 @@ HTML Fragments:
Use this for partial HTML files (e.g. inside `<template></template>` tags or HTML strings).

```js
const HtmlMinimizerPlugin = require("html-minimizer-webpack-plugin");
const path = require("node:path");
const CopyPlugin = require("copy-webpack-plugin");
const path = require("path");
const HtmlMinimizerPlugin = require("html-minimizer-webpack-plugin");

module.exports = {
module: {
Expand Down Expand Up @@ -607,9 +600,11 @@ Available [`options`](https://github.com/wilsonzlin/minify-html#minification).

HTML Documents:

<!-- eslint-skip -->

```js
const HtmlMinimizerPlugin = require("html-minimizer-webpack-plugin");
const CopyPlugin = require("copy-webpack-plugin");
const HtmlMinimizerPlugin = require("html-minimizer-webpack-plugin");

module.exports = {
module: {
Expand Down
8 changes: 8 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { defineConfig } from "eslint/config";
import configs from "eslint-config-webpack/configs.js";

export default defineConfig([
{
extends: [configs["recommended-dirty"]],
},
]);
1 change: 1 addition & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
module.exports = {
testEnvironment: "node",
testTimeout: 20000,
};
Loading
Loading