jrit / web-resource-inliner

Inlines img, script and link tags into the same file
MIT License
66 stars 29 forks source link

How to continue after error? #53

Open sarimabbas opened 4 years ago

sarimabbas commented 4 years ago

I am running the inliner on a JS-rendered HTML page saved with Chrome, which uses data-src attributes on some img tags to lazy-load images. For some reason the inliner seems to follow these attributes, and since it cannot find them, it throws an error. The text of the error is:

Uncaught (in promise) Error: Could not call remote method 'html'. Check that the method signature is correct. Underlying error: The file /Users/sarimabbas/Developer/.../previews/intrepid.png was not found!
Underlying stack: Error: The file /Users/sarimabbas/Developer/.../intrepid.png was not found!
    at DataURI.encodeSync (/Users/sarimabbas/Developer/.../src/frontend/node_modules/datauri/api.js:77:11)
    at new DataURI (/Users/sarimabbas/Developer/.../src/frontend/node_modules/datauri/index.js:13:34)
    at Object.util.getFileReplacement (/Users/sarimabbas/Developer/.../src/frontend/node_modules/web-resource-inliner/src/util.js:190:24)

For reference, here is the problematic HTML. The src asset is available, but the data-src asset was never made available by Chrome:

<img data-v-36a5c8b0="" class="image" data-src="/previews/intrepid.png" src="./page_files/intrepid.png" lazy="loaded">

Is there a way to continue silently, or otherwise skip all data attributes? Thank you!