Skip to content

Instantly share code, notes, and snippets.

@iamsalnikov
Last active August 8, 2018 15:27
Show Gist options
  • Save iamsalnikov/8803324 to your computer and use it in GitHub Desktop.
Save iamsalnikov/8803324 to your computer and use it in GitHub Desktop.
fontawesome icons class to php contants
<?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