Skip to content

Commit b3c218d

Browse files
author
Andreas Richter
committed
feat: add skipInternalWarnings flag to avoid console.warn output
1 parent c6faf2d commit b3c218d

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

index.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import type { Config as SvgoOptimizeOptions } from "svgo";
55

66
export interface HtmlnanoOptions {
77
skipConfigLoading?: boolean;
8+
skipInternalWarnings?: boolean;
89
collapseAttributeWhitespace?: boolean;
910
collapseBooleanAttributes?: {
1011
amphtml?: boolean;

lib/htmlnano.mjs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,9 @@ function htmlnano(optionsRun, presetRun) {
9898
await import(dependency);
9999
} catch (e) {
100100
if (e.code === 'MODULE_NOT_FOUND' || e.code === 'ERR_MODULE_NOT_FOUND') {
101-
console.warn(`You have to install "${dependency}" in order to use htmlnano's "${moduleName}" module`);
101+
if (!options.skipInternalWarnings){
102+
console.warn(`You have to install "${dependency}" in order to use htmlnano's "${moduleName}" module`);
103+
}
102104
} else {
103105
throw e;
104106
}

0 commit comments

Comments
 (0)