diff --git a/lib/fileprocessor.js b/lib/fileprocessor.js index 67a036d..a4fd3f1 100644 --- a/lib/fileprocessor.js +++ b/lib/fileprocessor.js @@ -70,6 +70,10 @@ var _defaultPatterns = { [ /]*[^\>\S]+src=['"]([^"']+)["']/gm, 'Update the HTML with the new image filenames for src links' + ], + [ + /<(?:img|source)[^\>]*[^\>\S]+srcset=['"]([^"'\s]+)(?:\s\d[mx])["']/gm, + 'Update the HTML with the new image filenames for srcset links' ] ], css: [ diff --git a/test/test-fileprocessor.js b/test/test-fileprocessor.js index f421c74..7477d14 100644 --- a/test/test-fileprocessor.js +++ b/test/test-fileprocessor.js @@ -231,6 +231,7 @@ describe('FileProcessor', function () { 'app/bar.css': 'bar.5678.css', 'app/baz.css': '/baz.8910.css', 'app/image.png': 'image.1234.png', + 'app/image@2x.png': 'image@2x.1234.png', 'app/video.webm': 'video.1234.webm', 'tmp/bar.css': 'bar.1234.css', 'app/foo.js': 'foo.1234.js', @@ -427,6 +428,15 @@ describe('FileProcessor', function () { assert.equal(replaced, ''); }); + it('should replace img reference in srcset', function () { + var content = ''; + var replaced = fp.replaceWithRevved(content, ['app']); + assert.equal(replaced, ''); + + content = ''; + replaced = fp.replaceWithRevved(content, ['app']); + assert.equal(replaced, ''); + }); }); describe('css type', function () {