Created
September 21, 2018 01:40
-
-
Save dongyuwei/0261a6f0bead1d66ebd1ab5b913cde21 to your computer and use it in GitHub Desktop.
find the svg which fontcustom failed to compile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
files = `ls ./svg_icons/*.svg` | |
bad_files = [] | |
files.split("\n").each {|f| | |
`rm -rf ./tmp ./tmp2` | |
`mkdir ./tmp` | |
`cp #{f} ./tmp` | |
ok = system("fontcustom compile ./tmp/ -o tmp2") | |
if $?.exitstatus != 0 | |
puts "bad file: #{f}" | |
bad_files.push f | |
end | |
} | |
puts "bad_files", bad_files |
二分查找应该会更快。但是对于100多个svg来说,上面顺序查找也很快。
去掉背景色框:
删除下列类似代码:
<g id="Color/Neutral/Grey-Icon" mask="url(#mask-2)" fill="#94A0B6">
<g transform="translate(-3.000000, -3.000000)" id="Base">
<rect x="0" y="0" width="24" height="24"></rect>
</g>
</g>
遇到不合预期(编译报错或者有背景黑色等常见问题)时,二分法注释掉svg部分代码可以很快定位问题,排除法 是比较有效的方法。
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
svg with
<polygon>
such aswill failed to compile.
id中含有中文字符的fontcustom也会编译失败