Context:
I'm minify-ing a file that contains both HTML and PHP content. For the most part this works completely fine. However, in the case where I am using PHP to set/echo an HTML attribute value (when I need a variable calculated from code), the minification process adds a leading and trailing whitespace around the PHP tags. This especially causes problems if the attribute is an element ID, as the extra space ruins any JS selectors that are expecting an ID without white space.
Example:
<table id="<?php echo $this->escapeHtmlAttr($this->table_id); ?>" >
becomes
<table id=" <?php echo $this->escapeHtmlAttr($this->table_id); ?> " >
The only options I have set are
removeComments: true,
collapseWhitespace: true