Last active
August 8, 2018 15:27
-
-
Save iamsalnikov/8803324 to your computer and use it in GitHub Desktop.
fontawesome icons class to php contants
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 | |
$pattern = '/\.fa-(.*):/'; | |
$subject = file_get_contents('font-awesome.css'); | |
preg_match_all($pattern, $subject, $matches); | |
$matches = $matches[1]; | |
$string = ''; | |
foreach($matches as $match){ | |
$match = 'fa-' . $match; | |
$string .= "const " . strtoupper(str_replace('-', '_', $match)) . " = '" . $match . "';\n"; | |
} | |
file_put_contents('faconst.php', "<?php\n\n" . $string ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment