简体   繁体   中英

Custom pattern for grunt-usemin poster attribute html video tag

I'm currently using yeoman and the grunt-usemin task to revved my assets. However, since I'm using the video tag, usemin ignores the poster attribute.

Eg

<video id="video-1" poster="/images/awesomeFeature.png">
  <source src="..."/>
</video>

After grunt-usemin I would expect the following:

<video id="video-1" poster="/images/ch6k8.awesomeFeature.png">
  <source src="..."/>
</video>

I tried using the documented patterns option documented here , such as the following:

usemin: {
    options: {
        assetsDirs: ['<%= cw.dist %>'],
        patterns: {
          html: [[/poster="([^"]*")/, 'Replacing reference to posters']]
        }
    },
    html: ['<%= cw.dist %>/{,*/}*.html'],
    css: ['<%= cw.dist %>/styles/{,*/}*.css']
}

However, it doesn't work. Examples from the grunt-usemin repository work with javascript, but I can't seem to make them work with HTML. Previous issues point that this is the right direction, but can't seem to find a working example. Ideas?

This issue has some details https://github.com/yeoman/grunt-usemin/issues/164

The gist is that you may need to alter usemin code. The issue has been closed, but I'm not sure the code as been fixed in the project.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM