Created
January 23, 2014 07:28
-
-
Save fumikito/8574410 to your computer and use it in GitHub Desktop.
Ligature Symbolsのフォントをfont-awesomeライクなSCSSに返還するスクリプト - HTMLのテーブルをコピーしてテキストファイルに貼付け
- Excelに貼付け後、TSVに書き出し
- そのtsvと同階層で実行
This file contains hidden or 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 | |
| $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