0

好的,我首先这样做了。

>grunt sass
Running "sass:dist" (sass) task
Warning:
You need to have Ruby and Sass installed and in your PATH for this task to work.
More info: https://github.com/gruntjs/grunt-contrib-sass
 Use --force to continue.

Aborted due to warnings.

我认为这是有道理的,我需要添加 ruby​​ 的路径,所以我做到了。然后我检查了 ruby​​ 的版本,它确实返回了一些东西

>ruby -v
ruby 2.2.5p319 (2016-04-26 revision 54774) [x64-mingw32]

这意味着我已经安装了 ruby​​。现在 grunt sass 应该可以工作,但它没有,我收到了同样的旧消息。这个:

>grunt sass
Running "sass:dist" (sass) task
Warning:
You need to have Ruby and Sass installed and in your PATH for this task to work.
More info: https://github.com/gruntjs/grunt-contrib-sass
 Use --force to continue.

Aborted due to warnings.

更新

我跑步时得到以下信息grunt-sass-force

>grunt sass --force
Running "sass:dist" (sass) task
Warning:
You need to have Ruby and Sass installed and in your PATH for this task to work.
More info: https://github.com/gruntjs/grunt-contrib-sass
 Used --force, continuing.
'sass' is not recognized as an internal or external command,
operable program or batch file.
Warning: Exited with error code 1 Used --force, continuing.

Done, but with warnings.
4

2 回答 2

1

看来您需要sass安装gem install sass. 没有 gem,你无法在 ruby​​ 中使用 sass。

于 2016-08-30T09:46:52.150 回答
0

Sass最初是使用ruby​​ 编程语言构建的。在构建系统上运行 Sass node(即 , grunt, gulpwebpack需要同时运行rubySass以及一种连接它们的方法(即 , grunt-contrib-sass, gulp-sasssass-loader

Ruby插件被称为gems,安装插件很容易:

gem install sass

另一方面,libsassc一个Sass不需要ruby. 安装后libsass,您将需要一种连接libsass方式node。您可以使用node-sass.

npm install node-sass

最后,LESS是一个竞争者,Sass它运行node并且不需要rubyor libsass

于 2016-08-30T15:47:43.130 回答