咕噜声 vs "Quotes"

Grunt vs "Quotes"

我只是 G运行t 的新手,但我花了很长时间解决一个简单的问题。正在将单引号转换为 html 个实体。我怎样才能避免这种转换?

原文HTML:

<button type="submit" onclick="document.forms['search'].submit(); return false;">Search                      </button>

运行g运行t 之后:

<button type="submit" onclick="document.forms[&apos;search**&apos;].submit(); return false;">Search</button>

谢谢

正如我之前所说,我是 GruntJS 的新手,所以我不确定这是否是最好的解决方案(我将不胜感激进一步的评论)。

但是,这对我有用: 我安装了 grunt-string-replace (https://github.com/erickrdch/grunt-string-replace) 并在 Gruntfile.js

中添加了以下代码
'string-replace': {
        dist: {
            files: {
                'dist/': '**/*.html'                   
            },


            options: {
                replacements: [{
                    pattern: /(&apos;)/ig,
                    replacement: '\''
                  }
                ]
            }
        }
    }

并且:

grunt.loadNpmTasks('grunt-string-replace');

grunt.task.run(['X', 'Y', 'Z','string-replace']);