这是什么语言? (训练营,指南针和萨斯)

时间:2014-08-14 16:54:48

标签: sass compass-sass

我正在使用Bootcamp进行单元测试。在Bootcamp官方教程中,有一个示例测试套装。它为您提供了三个文件:

功能/数学

@function power($base, $exponent) {
  $result: 1;

  @if $exponent >= 0 {
    @for $i from 1 through $exponent {
      $result: $result * $base;
    }
  } @else {
    @for $i from $exponent to 0 {
      $result: $result / $base;
    }
  }

  @return $result;
}

规格/ math.scss

@include describe("Math Power") {
  @include it("should expect positive values to be calculated correctly") {
    @include should( expect( power( 10, 2) ), to( equal(  100 )));
    @include should( expect( power(  2, 2) ), to( equal(    4 )));
    @include should( expect( power(0.5, 2) ), to( equal( 0.25 )));
  }

  @include it("should expect negative values to be calculated correctly") {
    @include should( expect( power( 10, -2) ), to( equal( 0.01 )));
    @include should( expect( power(  2, -2) ), to( equal( 0.25 )));
    @include should( expect( power(0.5, -2) ), to( equal(    4 )));
  }
}

specs.scss

@import "functions/math";

@import "bootcamp";
$bc-setting-verbose:  false;
$bc-setting-warnings: false;

@include runner-start;
@import "specs/math";
@include runner-end;

我知道数字3只是sass,不是吗?但是我不知道在数字1和2中使用了什么语言。今天我发现了Compass和Framework Bootcamp是什么框架,我不知道我正在阅读它的Compass或Bootcamp。

1 个答案:

答案 0 :(得分:1)

所有三个代码片段的语言都是Sass。 Compass和Bootcamp是基于Sass语言构建的框架。

来自Bootcamp的readme.md文件(https://github.com/thejameskyle/bootcamp):

  

使用Sass为Sass编写的Jasmine风格的BDD测试。

来自指南针的帮助页面(http://compass-style.org/help/):

  

Compass是一个开源的CSS创作框架,它使用Sass样式表语言使编写样式表变得强大而简单。