Last active
June 12, 2016 05:50
-
-
Save hexathos/74de75cb7754db54ab15b42798a839ea to your computer and use it in GitHub Desktop.
Get unicode hexadecimal value from fontawesome's _variables.scss (works on 4.6.3)
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
<?php | |
// For example if you need to print a fontawesome icon on an image... or as dropdown in a select box... | |
// works with fontawesome 4.6.3 | |
// proof of concept, maybe a bit slow -.- | |
$in = file_get_contents('_variables.scss'); | |
$out = array(); | |
preg_match_all("/fa-var-(.*): \"\\(.*)\";/", $in, $out); | |
$result = array(); | |
$count=0; | |
foreach($out[1] as $name) { | |
$result[$name] = $out[2][$count]; | |
$count++; | |
} | |
/* | |
print_r($result); | |
access via $result["archive"] for example . | |
echo "&\#x".$result["archive"].";"; | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment