Gulp SASS random() 在 ubuntu 服务器上失败

Gulp SASS random() failing on ubuntu server

在 ubuntu 服务器上编译时,sass 中的 random() 函数出现一些问题。

目前它在本地工作正常,但是如果我 运行 我的 ubuntu 框上的 gulp 任务 gulp-sass 输出只生成一次。

这是sass:

@function multipleBoxShadow($stars, $opacity) {
  $value: '#{random(2000)}px #{random(2000)}px rgba(255, 255, 255, #{$opacity})';
  @for $i from 2 through $stars {
    $value: '#{$value} , #{random(2000)}px #{random(2000)}px rgba(255, 255, 255, #{$opacity})'
  }
  @return unquote($value)
}

@mixin starBase($speed, $size, $amount, $opacity) {
  box-shadow: multipleBoxShadow($amount, $opacity);
  animation: animStar $speed linear infinite;
}

#stars {
  @include starBase(50s, 1px, 700, 1);
}

这是使用 gulp-sass 时 ubuntu 框中的输出:

#stars {
  animation: animStar 100s linear infinite;
  box-shadow: 321px 321px rgba(255, 255, 255, 1) , 321px 321px rgba(255, 255, 255, 1) , 321px 321px rgba(255, 255, 255, 1) etc etc....
}

如您所见,它只生成一次随机数,并在所有重复中使用相同的值,这与我的本地机器每次输出都是随机的不同。

如果我随后尝试在 g运行t sass sass/default.css style/default.css 之外使用 sass 编译器,那么 random() 将完全失败:

#stars {
  animation: animStar 100s linear infinite;
  box-shadow: random(2000)px random(2000)px rgba(255, 255, 255, 1) , random(2000)px random(2000)px rgba(255, 255, 255, 1) etc etc....
}

我需要在我的 ubuntu 盒子上安装什么东西才能使 random() 正确编译吗?我一直认为它是原生的 sass.

这里有一个 SassMeister 来演示正确的编译: http://sassmeister.com/gist/165fe1dcc831220c8717

原来我的服务器上安装了错误的 sass 版本,可能应该先检查一下。它现在可以使用 sass 编译器,sass-gulp 仍然只生成一次 random() 但是