Image address in ember templates grunt build

前端 未结 4 2098
粉色の甜心
粉色の甜心 2021-01-01 01:51

I used Yeoman to create a web app in EmberJS. Everything works ok, but after using the grunt build command, if I view the built app in the browser (from dist di

4条回答
  •  [愿得一人]
    2021-01-01 02:04

    Try this:

    usemin: {
                html: ['<%= yeoman.dist %>/**/*.html'],
                css: ['<%= yeoman.dist %>/styles/{,*/}*.css'],
                js: ['<%= yeoman.dist %>/scripts/**/*.js'],
                options: {
                    dirs: ['<%= yeoman.dist %>', '<%= yeoman.dist %>/styles', '<%= yeoman.dist %>/scripts'],
                    assetsDirs: ['<%= yeoman.dist %>', '<%= yeoman.dist %>/styles', '<%= yeoman.dist %>/scripts'],
                    patterns: {
                        js: [
                            [/["']([^:"']+\.(?:png|gif|jpe?g))["']/img, 'Image replacement in js files']
                        ]
                    }
                }
            }
    

    From here: Grunt plugin for assets versioning

    The regex glob validates, as opposed to other solution shown here.

    Also rolled back to use-min 2.1.1 npm install grunt-usemin@2.1.1 --save-dev

    Although, I think 'assetsDirs' as opposed to just 'dirs' causes the undefined function error?

提交回复
热议问题