Skip to content

Commit 03a81db

Browse files
committed
docs(readme): revert earlier changes
1 parent 687b4f9 commit 03a81db

File tree

1 file changed

+2
-63
lines changed

1 file changed

+2
-63
lines changed

README.md

+2-63
Original file line numberDiff line numberDiff line change
@@ -241,69 +241,6 @@ module.exports = {
241241

242242
If the tag name is not specified it will process all the tags.
243243

244-
**Note:** source with a `tag` option takes precedence over source without.
245-
246-
For example, to process `data-src` attributes on _all_ tags, omit the tag name:
247-
248-
**webpack.config.js**
249-
250-
```js
251-
module.exports = {
252-
module: {
253-
rules: [
254-
{
255-
test: /\.html$/i,
256-
loader: "html-loader",
257-
options: {
258-
sources: {
259-
list: [
260-
{
261-
attribute: "data-src",
262-
type: "src",
263-
},
264-
],
265-
},
266-
},
267-
},
268-
],
269-
},
270-
};
271-
```
272-
273-
> ⚠ You **must** specify a tag name if using `...` to extend attributes for tags already in the default sources list
274-
275-
For example, to extend the default source list so that it also processes `data-src` attributes on _all_ tags, you might be tempted to do this:
276-
277-
```js
278-
module.exports = {
279-
module: {
280-
rules: [
281-
{
282-
test: /\.html$/i,
283-
loader: "html-loader",
284-
options: {
285-
sources: {
286-
list: [
287-
// All default supported tags and attributes
288-
"...",
289-
{
290-
attribute: "data-src",
291-
type: "src",
292-
},
293-
],
294-
},
295-
},
296-
},
297-
],
298-
},
299-
};
300-
```
301-
302-
However this will only process `data-src` attributes on tags that _aren't in the default list_:
303-
304-
- `<p data-src="..">` will be processed, as `p` is not in the default sources list
305-
- `<img data-src="..">` won't be processed, as `img` is already in the default sources list
306-
307244
> You can use your custom filter to specify html elements to be processed.
308245
309246
For example:
@@ -383,6 +320,8 @@ module.exports = {
383320
};
384321
```
385322

323+
**Note:** source with a `tag` option takes precedence over source without.
324+
386325
Filter can be used to disable default sources.
387326

388327
For example:

0 commit comments

Comments
 (0)