タグ

Functionに関するyuhiiskのブックマーク (4)

  • Simple Asset Helper Functions | CSS-Tricks

    Dealing with paths is always a bit annoying, you will concede. Fortunately, it is extremely easy with Sass to have a beautiful API to manage assets and to keep the code simple to maintain. The only thing we need is to store the base asset path in a variable, and a couple of functions to build our API. /// Base path for assets (fonts, images...), /// should not include trailing slash /// @access pu

    Simple Asset Helper Functions | CSS-Tricks
  • Ruby で Sass のカスタム関数を書く

    Sass で関数を書く方法は 2 つあります。ひとつは Sass の @function ディレクティブ を使って Sass ファイル内に定義する方法。 $grid-width: 40px; $gutter-width: 10px; @function grid-width ($n) { @return $n * $grid-width + ($n - 1) * $gutter-width; } 簡単かつカジュアルに書ける反面、当然ながら Sass のネイティブ関数やディレクティブの制限を受けるので、できないことも多いです。とくに Sass は文字列系の関数があまり用意されておらず、不満を感じることも少なくありません。 もうひとつの方法は、Ruby でカスタム関数を書いて Sass を拡張する という方法です。Ruby の知識が必要で、かつ Sass ファイルに直接定義するのとは違って別フ

    Ruby で Sass のカスタム関数を書く
  • sassの抑えておきたいfunctionの使い方 « NAVER Engineers' Blog

    こんにちは。 年末の予定はぶっ通しでスカイリムにつぎ込むことが決定したUIT富田です。 今回は、Less & Sass Advent calendar 2011の6日目として、 sassのfunctionについて解説します。 すっぽりハマった四則演算の落とし穴 sassは値の四則演算をサポートしており、10進数だけでなく、16進数の値であってもよしなに計算してくれます。 color: #a3a4a5 + #111111; ↓ color: #b4b5b6; 16進数と10進数でもエラーにならず計算してくれます。(普通あまりやらないとは思いますが) color1: #000000 + 1; color2: #000000 + 15; ↓ color1: #010101; color2: #0f0f0f; この16進数の計算は、結果が#fffffを上回った場合、上回った分は切り捨てて、す

  • Sass: Built-In Modules

    Only Dart Sass currently supports loading built-in modules with @use. Users of other implementations must call functions using their global names instead. Sass provides many built-in modules which contain useful functions (and the occasional mixin). These modules can be loaded with the @use rule like any user-defined stylesheet, and their functions can be called like any other module member. All b

  • 1