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

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,18 +55,18 @@ You may need to specify loaders for images in your configuration (recommended `f

## Options

| Name | Type | Default | Description |
| :-------------------------------: | :-----------------: | :----------------------------------------------------------------------------------------------------: | :--------------------------------------- |
| **[`attributes`](#attributes)** | `{Array\|String}` | `[':srcset', 'img:src', 'audio:src', 'video:src', 'track:src', 'embed:src', 'source:src','input:src']` | Enables/Disables attributes handling |
| **[`root`](#root)** | `{String}` | `undefiend` | Allow to handle root-relative attributes |
| **[`interpolate`](#interpolate)** | `{Boolean\|String}` | `false` | Allow to use expressions in HTML syntax |
| **[`minimize`](#minimize)** | `{Boolean\|Object}` | `true` in production mode, otherwise `false` | Tell `html-loader` to minimize HTML |
| **[`esModule`](#esmodule)** | `{Boolean}` | `false` | Use ES modules syntax |
| Name | Type | Default | Description |
| :-------------------------------: | :-----------------: | :-------------------------------------------------------------------------------------------------------------------: | :--------------------------------------- |
| **[`attributes`](#attributes)** | `{Array\|String}` | `[':srcset', 'img:src', 'audio:src', 'video:src', 'track:src', 'embed:src', 'source:src','input:src', 'object:data']` | Enables/Disables attributes handling |
| **[`root`](#root)** | `{String}` | `undefiend` | Allow to handle root-relative attributes |
| **[`interpolate`](#interpolate)** | `{Boolean\|String}` | `false` | Allow to use expressions in HTML syntax |
| **[`minimize`](#minimize)** | `{Boolean\|Object}` | `true` in production mode, otherwise `false` | Tell `html-loader` to minimize HTML |
| **[`esModule`](#esmodule)** | `{Boolean}` | `false` | Use ES modules syntax |

### `attributes`

Type: `Array|String`
Default: `[':srcset', 'img:src', 'audio:src', 'video:src', 'track:src', 'embed:src', 'source:src','input:src']`
Default: `[':srcset', 'img:src', 'audio:src', 'video:src', 'track:src', 'embed:src', 'source:src', 'input:src', 'object:data']`

You can specify which tag-attribute combination should be processed by this loader via the query parameter `attributes`.
Pass an array or a space-separated list of `<tag>:<attribute>` combinations. (Default: `attributes=img:src`)
Expand Down
1 change: 1 addition & 0 deletions src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ function getTagsAndAttributes(attributes) {
'embed:src',
'source:src',
'input:src',
'object:data',
];

if (typeof attributes !== 'undefined') {
Expand Down
54 changes: 42 additions & 12 deletions test/__snapshots__/attributes-option.test.js.snap

Large diffs are not rendered by default.

15 changes: 12 additions & 3 deletions test/__snapshots__/esModule-option.test.js.snap

Large diffs are not rendered by default.

5 changes: 4 additions & 1 deletion test/__snapshots__/loader.test.js.snap

Large diffs are not rendered by default.

30 changes: 21 additions & 9 deletions test/__snapshots__/minimize-option.test.js.snap

Large diffs are not rendered by default.

10 changes: 8 additions & 2 deletions test/__snapshots__/root-option.test.js.snap

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions test/fixtures/simple.html
Original file line number Diff line number Diff line change
Expand Up @@ -111,3 +111,5 @@ <h2>An Ordered HTML List</h2>
<video src="example.ogg" controls>
Your browser does not support the video tag.
</video>

<object width="400" height="400" data="example.pdf"></object>