使用 grunt-contrib-htmlmin 时解析错误?

Parse error while using grunt-contrib-htmlmin?

我正在尝试使用 grunt-contrib-htmlmin 缩小 HTML 个文件。但是我一直收到 Parse Error。下面是 command line 响应。

Running "htmlmin:dist" (htmlmin) task
Warning: template/applications/applications.html
Parse Error: <a class="btn btn-default" href="#" role="button" data-i18n="[title
]Reset_filter" , data-bind="click:function(){clearfilter('jqxgridApplications')}
"><i class="icon-reset-filter"></i></a>
                        <a class="btn btn-default" href="#" role="button" da
 ta-toggle="modal" data-target="#hideShowColumns" ,data-i18n="[title]show_hide" d
ata-bind="click: function () {openPopup('modelShowHideCol','jqxgridApplications'
)}"><i class="icon-hide-column"></i></a>
                        <a class="btn btn-default" href="#" role="button" da
ta-i18n="[title]exportToXls" data-bind="click:function(){exportToExcel(true,'jqx
gridApplications')}"><i class="icon-export-excel"></i></a>
                        <a class="btn btn-default" href="#" role="button" da
ta-i18n="[title]refresh_data" data-bind="click:function(){refreshGrid('jqxgridAp
plications')}"><i class="icon-spinner9"></i></a>

                    </div>
                </div>
            </div>

            <div class="row">
                <div class="col-md-12">
                    <div class="grid-area">
                        <div id="jqxgridApplications" style="width:100%">
                        </div>
                        <div id="pagerDivApplication"></div>
                    </div>
                </div>
            </div>

            <div class="modal fade bs-example-modal-lg" id="applicationModel
" data-backdrop="static" tabindex="-1" role="dialog" aria-labelledby="myModalLab
el" aria-hidden="true">
                <div data-bind="if: templateFlag">
                    <div data-bind='component:observableModelPopup'>

                    </div>
                </div>
            </div>

        </div>
    </div>
</div>
</div> Use --force to continue.

Aborted due to warnings.

即使我使用 --force 错误也是一样的? 非常感谢任何帮助。

下面是我如何定义 htmlmin 任务。

htmlmin: {
dist: {
  files: [{
     expand: true,
     cwd: 'template',
     src: '**/*.html',
     dest: 'template_dist/'
   }]
 }
}

您的前两个锚元素在数据属性之间有一个额外的逗号。第一个在 data-i18n 属性之后有一个逗号,第二个在 data-target 之后有一个逗号。尝试删除逗号,看看解析错误是否消失。