Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

favicon 图标文件的静态资源前缀无法添加 #69

Closed
BigKongfuPanda opened this issue Jul 6, 2018 · 0 comments
Closed

favicon 图标文件的静态资源前缀无法添加 #69

BigKongfuPanda opened this issue Jul 6, 2018 · 0 comments

Comments

@BigKongfuPanda
Copy link

BigKongfuPanda commented Jul 6, 2018

问题:

网站 title 上面的 favicon 图标,文件后缀为 .ico,下面这种方式加入的:

<link rel="icon" type="image/x-icon" href="images/favicon.ico">

构建后,发现 href 后面的链接没有添加静态资源前缀,导致引入失败,图标显示不了。

解决办法:

在获取静态资源类型的函数 util.getStaticFileType 中加入 ico 的类型。

util.js

util.getStaticFileType = () => {
    var list = [
        'css',
        'js',
        'jpg', 'jpeg', 'png', 'gif', 'webp', 'ico',
        'mp3', 'aac', 'mpeg', 'flv', 'f4v', 'swf', 'ogg', 'mp4', 'm4v', 'webm', 'wav', 'ogv', 'mov', 'm3u8',
        'ttf', 'otf', 'eot', 'woff', 'woff2', 'svg',
        'vml', 'htc'
    ];
    return list.map(item => '**/*.' + item);
};

结果

构建后,静态资源前缀添加上了,图标能够正常显示。

不知道这样解决这个问题是否合理???

@holyzfy holyzfy closed this as completed in dbd9b89 Jul 7, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant