浏览代码

Fix font icon parsing.

mscherer 5 年之前
父节点
当前提交
f24ad7f8ef
共有 1 个文件被更改,包括 3 次插入8 次删除
  1. 3 8
      src/IdeHelper/Generator/Task/FormatIconTask.php

+ 3 - 8
src/IdeHelper/Generator/Task/FormatIconTask.php

@@ -34,7 +34,7 @@ class FormatIconTask implements TaskInterface {
 	}
 	}
 
 
 	/**
 	/**
-	 * Fontawesome v4
+	 * Fontawesome v4 using .../scss/_variables.scss
 	 *
 	 *
 	 * @return string[]
 	 * @return string[]
 	 */
 	 */
@@ -46,13 +46,8 @@ class FormatIconTask implements TaskInterface {
 		$icons = [];
 		$icons = [];
 		if ($fontFile && file_exists($fontFile)) {
 		if ($fontFile && file_exists($fontFile)) {
 			$content = file_get_contents($fontFile);
 			$content = file_get_contents($fontFile);
-			preg_match_all('/glyph-name="([a-z][^"]+)"/', $content, $matches);
-			$icons = $matches[1];
-			foreach ($icons as $key => $icon) {
-				if (strpos($icon, 'uni') === 0 || preg_match('#[a-z]\d[a-z]\d#i', $icon)) {
-					unset($icons[$key]);
-				}
-			}
+			preg_match_all('/\$fa-var-([0-9a-z-]+):/', $content, $matches);
+			$icons = !empty($matches[1]) ? $matches[1] : [];
 		}
 		}
 
 
 		$icons = array_merge($configured, $icons);
 		$icons = array_merge($configured, $icons);