-
Notifications
You must be signed in to change notification settings - Fork 571
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
default true CLI options can't be disabled ("include-auto-generated-tags") #860
Comments
bulk88
added a commit
to bulk88/tinymta
that referenced
this issue
Oct 17, 2017
kangax/html-minifier#860 extra "</a>" close tags were being added, and couldn't be disabled in minified output, because "includeAutoGeneratedTags" can't be set to false from cmd line,this commit is for a future commit
alexlamsl
added a commit
that referenced
this issue
Mar 14, 2018
alexlamsl
added a commit
that referenced
this issue
Mar 14, 2018
bulk88
added a commit
to bulk88/html-minifier
that referenced
this issue
Apr 14, 2021
the fix for kangax#860 enabled disabling these 2 flags from the command line but also made them uncontrollable from the JSON config file old commander.js (not 2021 commander.js) assigns boolean true unconditionally as defaultValue for all --no- arguments, when minifier fuses command line and JSON config file options together in cli.js's createOptions(), it sees program["includeAutoGeneratedTags"] = true and ignored config["includeAutoGeneratedTags"], in my case "= false". Delete the defaultValue/key from commander.js object before parsing user's ARGV to solve the bug.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
given file
which has target anchors with no contents and no closing tag. No closing tag is on purpose for space optimization, since HTML prohibits an A tag in an A tag and implicitly closes the last one when it encounters an opening A tag. I am using the following line to minify this HTML file.
gives
<meta content=0 name=mobileoptimized><a href=#1> 1 </a> <a href=#2> 2 </a> <a href=#3> 3 </a> <a href=#4> 4 </a> <a href=#5> 5 </a><br><br><a name=1>1: <a href=#A>A</a><br><a name=2>2: <a href=#B>B</a><br><a name=3>3: <a href=#C>C</a><br><a name=4>4: <a href=#D>D</a><br><a name=5>5: <a href=#E>E</a><br><br><br><a name=A><a href=s.htm#A1>Page 1</a><br><a name=B><a href=s.htm#A2>Page 2</a><br><a name=C><a href=s.htm#A3>Page 3</a><br><a name=D><a href=s.htm#A4>Page 4</a><br><a name=E><a href=s.htm#A5>Page 5</a><br></a></a></a></a></a></a></a></a></a></a>
with all those extra "</a>"s. Adding "--include-auto-generated-tags" doesn't change the output, since the default for "includeAutoGeneratedTags" is true. "--noinclude-auto-generated-tags" and "--no-include-auto-generated-tags" dont change the output either.
"--include-auto-generated-tags 0" breaks everything
If I use the following JSON config
it produces the extra "</a>"s. If I add "includeAutoGeneratedTags": false to the config file, the extra "</a>"s are gone. So its not possible AFAIK to turn off includeAutoGeneratedTags from the CLI.
The text was updated successfully, but these errors were encountered: