jrit / web-resource-inliner

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

Turn off warnings as well as errors? #25

Open Heydon opened 7 years ago

Heydon commented 7 years ago

The warnings for missing assets are quite verbose. Can I have a way to turn them off? Or is there a way already?

jrit commented 7 years ago

Not really at the moment. If you set strict to true then an exception gets thrown instead, but I'm quite sure that isn't what you want here :) I'd accept a PR to set a logLevel, but it likely isn't something I'll work on myself.

Heydon commented 7 years ago

@jrit Thank you for the reply. In my case, the warnings involve using SVG xlink. I tried getting these to be ignored using data-inline as an exception for images.

<a href="#{{slug}}" aria-label="link">
  <svg><use data-inline xlink:href="#icon-link"></use></svg>
</a>

But this didn't work. Any ideas? (I tried data-inline on the <svg> element too...)

tommedema commented 7 years ago

@jrit I'm considering to write a PR for this. Any suggestion on the approach, i.e. the different log levels (or simply a boolean whether to log or not?), and which lines of code are relevant?

jrit commented 7 years ago

@tommedema that strict option should probably be removed and replaced with a strictness option that takes one of error, warning, silent, or something like that. The current default would be equivalent to warning which I think should be kept. The relevant lines should be easy to find by searching for occurrences of the strict option. Let me know if you have other thoughts.