I've got two images, a green check mark and a grey check mark. These are shown/hidden as the user checks or unchecks an item in a list. The problem I'm having is that when minifying the app's images with grunt-contrib-imagemin
, these two images ng-src
doesn't change to the minified image name. Any ideas why this happens and how to fix it?
<img ng-if="item.checkedState === 'unchecked'" ng-src="images/unchecked.png" ng-click="changeCheckedState(item)">
<img ng-if="item.checkedState === 'checked'" ng-src="images/checked.png" ng-click="changeCheckedState(item)">
My usemin task:
usemin: {
html: ['<%= yeoman.dist %>/{,*/}*.html'],
css: ['<%= yeoman.dist %>/styles/{,*/}*.css'],
options: {
assetsDirs: ['<%= yeoman.dist %>','<%= yeoman.dist %>/images']
}
}
EDIT: By testing @Tony Barnes solution:
usemin: {
html: ['<%= yeoman.dist %>/{,*/}*.html'],
css: ['<%= yeoman.dist %>/styles/{,*/}*.css'],
options: {
assetsDirs: ['<%= yeoman.dist %>','<%= yeoman.dist %>/images'],
patterns: {
html: [
[/<img[^\>]*[^\>\S]+ng-src=[""]([^'"\)#]+)(#.+)?["']/gm, 'Update the HTML with non standard ng-src attribute on img']
]
}
}
}
The other src names for scripts and styles fails, i.e. the file vendors132918.js
becomes vendor.js
in the src
which then throws a 404 not found
error since the file isn't called vendor.js
. What is causing the other src
's to fail here? The pattern shouldn't change anything except for the src on images as far as I can see..