fitztrev/laravel-html-minify

Error with Gulp html compress

sakanaproductions opened this issue · 6 comments

I'm getting the following error when running the gulp compress from your wiki:

[21:03:45] Starting 'compress'...

events.js:141
throw er; // Unhandled 'error' event
^
Error: Parse Error: <a class="btn btn-primary navbar-btn" isCreatable() ? '' : 'disabled'); ?> href="">


<table class="table table-striped table-hover" id="dataTable" renderTableAttributes(); ?>>



renderHeader(); ?>

                        <?php endforeach; ?>
                    </tr>
                </thead>
                <tbody>
                    <?php foreach($rows as $row): ?>
                        <tr>
                            <?php foreach($columns as $column): ?>
                                <?php echo $column->render($row, count($rows)); ?>

                            <?php endforeach; ?>
                        </tr>
                    <?php endforeach; ?>
                </tbody>
                <?php if($modelItem->isColumnFilter() && ! $modelItem->isAsync()): ?>
                    <tfoot>
                        <tr>
                            <?php foreach($columns as $column): ?>
                                <td></td>
                            <?php endforeach; ?>
                        </tr>
                    </tfoot>
                <?php endif; ?>
            </table>
        </div>
    </div>
</div>
stopSection(); ?> make('admin::_layout.inner', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>

I had the same issue; it's because of the nested PHP tags within the HTML tags. I opened this issue in the kangax/html-minifier repo and they updated it to include an option for ignoreCustomFragments.

kangax/html-minifier#421

-Garrett

I updated the wiki in this repo to reflect this fix (hope owner doesn't mind). Also, be sure to update to the latest version of html-minifier.

-Garrett

Scratch that wiki update, just noticed the latest html-minifier ignores those custom fragments by default.

-G

@grimmdude okay, updated html-minifier and now getting this:

events.js:141 throw er; // Unhandled 'error' event ^ Error: Parse Error: <a {...this.props} href="javascript:;" role="button" className={(this.props.className || '') + ' btn'} data-keyboard="true" /> ); } });

I think the issue is with those embedded quotes in the className attribute. You'll need to write a regEx to ignore those {} blocks and use is in the ignoreCustomFragments option. Check this comment: kangax/html-minifier#421 (comment)

awesome, got it... i wasn't using Regex for ignoreCustomFragments... thanks again.