-
-
Notifications
You must be signed in to change notification settings - Fork 204
Closed
Description
- Operating System: mac os
- Node Version: v12.16.3
- NPM Version: 6.14.8
- webpack Version: "^5.6.0"
- html-loader Version: "^1.3.2"
Expected Behavior
<img width="80" height="100" src="<%= getURl()%>" srcset="<%= getURl() 2x" alt="false">
I wanna html-loader ignore my srcset attributes, or just parse like src.
Actual Behavior
HtmlSourceError: Bad value for attribute "srcset" on element "img": Invalid srcset descriptor found in '<%= getUrl()%> 2x' at '2x' (From line 15, column 3; to line 15, column 89)
and it show this error.
but it works fine on src attributes, when I write like this
<img width="80" height="100" src="<%= getURl()%>" alt="false">
Code
{
loader: 'html-loader',
options: {
attributes: {
list: [
'...',
{
tag: 'img',
attribute: 'srcset',
type: 'srcset',
filter: (tag, attribute, attributes) => {
if (tag === 'img' && attribute === 'srcset' && attributes.srcset.indexOf('<%=') > -1) {
return false;
}
return true;
},
}
]
},
},
I try to reset the default srcset
like this.
but it look like the default srcset
still render before my custom.
how to ignore srcset?
or how to merge the default set
// additional code, HEY YO remove this block if you don't need it
How Do We Reproduce?
Metadata
Metadata
Assignees
Labels
No labels