首先我做了这个。
>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.
标题>看起来您需要在安装gem install sass
的同时安装sass
。如果没有gem,你就不能使用sass。
Sass
最初是使用ruby编程语言构建的。在node
构建系统上运行Sass。, grunt
, gulp
, webpack
)需要同时运行ruby
和Sass
以及连接它们的方法(即。, grunt-contrib-sass
, gulp-sass
, sass-loader
)。
Ruby插件被称为gems
,安装插件很容易:
gem install sass
另一方面,libsass是Sass
的c
实现,不需要ruby
。在安装libsass
之后,您将需要一种将libsass
连接到node
的方法。您可以使用node-sass
。
npm install node-sass
最后,LESS
是Sass
的竞争对手,它运行在node
上,不需要ruby
或libsass
。