diff --git a/lib/parse.js b/lib/parse.js index aae014d..b1f4ae4 100644 --- a/lib/parse.js +++ b/lib/parse.js @@ -10,7 +10,7 @@ const { isIgnored, isRemoteFilepath, parseAttributes, - parseProps, + parseProps } = require('./utils'); const htmlparser = require('htmlparser2'); const path = require('path'); @@ -48,7 +48,7 @@ module.exports = async function parse(context) { (tag === 'link' && attributes.rel && attributes.rel !== 'stylesheet' && - attributes.rel !== 'icon') + !attributes.rel.includes('icon')) ) { return; } @@ -85,7 +85,7 @@ module.exports = async function parse(context) { svgAsImage: 'svgasimage' in props ? props.svgasimage : context.svgAsImage, tag: match[1], - type, + type }); } } diff --git a/test/6a-inline-link-test.js b/test/6a-inline-link-test.js new file mode 100644 index 0000000..e53fe16 --- /dev/null +++ b/test/6a-inline-link-test.js @@ -0,0 +1,25 @@ +'use strict'; + +const { expect } = require('chai'); +const { inlineSource: inline } = require('..'); + +describe('inline ', () => { + before(function() { + process.chdir(require('path').resolve(__dirname, './fixtures')); + }); + it('should inline PNG favicon sources with rel="icon" [DUPLICATE from 6-inline-link-test]', async () => { + const test = ''; + const html = await inline(test, { compress: true }); + expect(html).to.eql( + '' + ); + }); + it('should inline favicon sources with rel="shortcut icon"', async () => { + const test = + ''; + const html = await inline(test, { compress: true }); + expect(html).to.eql( + '' + ); + }); +});