CSS Preprocessor Advent Calendar 2012の8日目でございます。飛び道具的な好奇心に基づき、functionの拡張について調べてみた次第。 今回は、下記の2つの関数をサンプルとして扱います。どちらも実用的なものではありませんが、あくまでサンプルということで、、、。 reverse - 与えられた文字列を逆順に並べ直して返す randomColor - ランダムなカラーの16進数を返す Sass編 Sass - Syntactically Awesome Stylesheets Module: Sass::Script::FunctionsにあるAdding Custom Functionsを参考にします。じつは、LESSとStylusは使ってたんですが、Sassって使ったことないんですよね...。 sass_add_func.rb Sass::Script:
![CSSプリプロセッサのfunctionを拡張してみた (CSS Preprocessor Advent Calendar 8th day)](https://cdn-ak-scissors.b.st-hatena.com/image/square/2183e9bbc25dbbdb50624f0d9497aa7861959398/height=288;version=1;width=512/https%3A%2F%2Fhavelog.aho.mu%2Fogp-default.jpg)