LoginSignup
2
2

More than 5 years have passed since last update.

compassのソース内で環境判別

Posted at

したいよ、環境判別

compass_env()で判別する関数用意。
例は開発環境かどうかを判別する関数。

@function is_development(){
  @return compass_env() == development;
}

こんな使い方

環境によってコメントを出力する。スタイルガイドとか。

@mixin cs-some-module($some-arg){

  @if is_development(){
/*  
## cs-some-module

description

```
<div class="primary-header">
  <h2><span class="primary-header__body">Title</span></h2>
</div>
```
*/
  }
}

可読性は微妙ですね。

2
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
2