Skip to content

Commit

Permalink
fix: loosen check on rel attribute (#45)
Browse files Browse the repository at this point in the history
Fixes #45 

The `shortcut` link type is deprecated as of now and is not recommended
accordingly to MDN. To make a new version of the check work with old
codebases we moved from an exact match strategy to a regex-based one.
  • Loading branch information
ZuBB authored Apr 20, 2024
1 parent 8658d2c commit 91135eb
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/inlineFavicon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { PostHTML } from 'posthtml';
function inlineFavicon(options: IOptions = { path: '' }) {
return function plugin(tree: PostHTML.Node) {
tree.match(
{ tag: 'link', attrs: { rel: 'shortcut icon', href: new RegExp(/\S+/) } },
{ tag: 'link', attrs: { rel: new RegExp(/icon/), href: new RegExp(/\S+/) } },
node => {
const href = node.attrs!.href as string;
const file = path.join(process.cwd(), options.path || '', href);
Expand Down

0 comments on commit 91135eb

Please sign in to comment.