grunt的grunt-contrib-levin-usemin无法替换静态文件引用

静态文件加上md5前缀的任务没问题,就是替换html文件的静态文件名没有执行。是不是grunt不支持Play framework的模版语法啊

我想替换的html 文件

<link rel="stylesheet" href="@{'/public/stylesheets/work/work.css'}">
<script charset="${_response_encoding}" src="@{'/public/javascripts/work/jquery.min.js'}"></script>
#{stylesheet 'flexigrid.css' /}
#{script 'flexigrid.js' /}

这是我的Gruntfile.js

module.exports = function(grunt) {
    grunt.initConfig({
        rev: {
            options: {
                encoding: 'utf8',
                algorithm: 'md5',
                length: 8
            },
            assets: {
                src: [
                 'public/javascripts/**/*.js',
                 'public/stylesheets/**/*.css',
                ]
            }
        },
        usemin: {
            css:{
                files:{
                    src:['public/stylesheets/**/*.css']
                }
            },
            js:['public/javascripts/**/*.js '],
            html:['app/views/**/*.html'],
            options:{
                assetsDirs: ['static', 'public/'],
                patterns: {
                    js: [[/(\/public\/images\/[\/\w-]+\.jpg)/, 'replace image in js']]
                }
            }
        }
    });

    grunt.loadNpmTasks('grunt-rev');
    grunt.loadNpmTasks('grunt-contrib-levin-usemin');

    grunt.registerTask('default', ['rev', 'usemin']);
};
阅读 1.2k
评论 2017-07-10 提问
    撰写回答

    登录后参与交流、获取后续更新提醒