Skip to content

Commit 77d24a6

Browse files
The failed is an interesting idea to implement in the future. However the webpack build will fail whether there was a local file error or an URL file error.
1 parent 6251061 commit 77d24a6

1 file changed

Lines changed: 5 additions & 20 deletions

File tree

index.js

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -266,14 +266,7 @@ class HtmlWebpackInlineSVGPlugin {
266266
// process the imageNodes
267267

268268
this.updateHTML(html, inlineImages)
269-
.then((html) => {
270-
if (!this.allowFromUrl) {
271-
resolve(html)
272-
}
273-
274-
const newHtml = html.replace(/failed /gi, '')
275-
resolve(newHtml)
276-
})
269+
.then((html) => resolve(html))
277270
.catch((err) => {
278271

279272
console.log(chalk.underline.red('processImages hit error'))
@@ -415,19 +408,11 @@ class HtmlWebpackInlineSVGPlugin {
415408
*/
416409
isNodeValidInlineImage (node) {
417410

418-
const isInlineAllAndDoesNotHaveInlineExclude = (
419-
this.inlineAll && _.filter(node.attrs, { name: 'inline-exclude' }).length === 0
420-
)
421-
const isInlineNotMarkedAsFailed = (
422-
_.filter(node.attrs, { name: 'inline' }).length &&
423-
_.filter(node.attrs, { name: 'failed' }).length === 0
424-
)
425-
426411
return !!(
427-
node.nodeName === 'img' &&
428-
(isInlineAllAndDoesNotHaveInlineExclude || isInlineNotMarkedAsFailed) &&
429-
this.getImagesSrc(node)
430-
)
412+
node.nodeName === 'img'
413+
&& ((this.inlineAll && _.filter(node.attrs, { name: 'inline-exclude' }).length === 0)
414+
|| _.filter(node.attrs, { name: 'inline' }).length)
415+
&& this.getImagesSrc(node))
431416

432417
}
433418

0 commit comments

Comments
 (0)