Skip to content

Instantly share code, notes, and snippets.

@fumikito
Created January 23, 2014 07:28
Show Gist options
  • Select an option

  • Save fumikito/8574410 to your computer and use it in GitHub Desktop.

Select an option

Save fumikito/8574410 to your computer and use it in GitHub Desktop.
Ligature Symbolsのフォントをfont-awesomeライクなSCSSに返還するスクリプト - HTMLのテーブルをコピーしてテキストファイルに貼付け - Excelに貼付け後、TSVに書き出し - そのtsvと同階層で実行
<?php
$file = explode("\n", file_get_contents('./lsf.txt'));
$variables = [];
$sass = [];
foreach($file as $row){
list($title, $aliases, $unicode) = array_map('trim', explode("\t", trim($row)));
$title = 'lsf-'.$title;
$aliases = trim($aliases, '"');
$variables[$title] = $unicode;
foreach(explode(',', $aliases) as $a){
$name = trim($a);
$sass[$name] = $title;
}
}
var_dump($sass, $variables);
foreach($variables as $name => $var){
$str = "\${$name}: \"{$var}\";\n\n";
file_put_contents('./_lfs_variables.scss', $str, FILE_APPEND);
}
foreach( $sass as $class => $var ){
$str = <<<EOS
.lsf-{$class}:before{
content: \${$var};
}
EOS;
file_put_contents('./_lfs_icon.scss', $str, FILE_APPEND);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment