gulp-ruby-sass不是Windows中公认的命令

Mar*_*ers 6 windows gulp gulp-sass

我在Windows Server 2012 VM上第一次尝试gulp.我通常是Mac用户,所以对于像这样的开发工具我对Windows和Powershell有点新.我安装了Node.js和npm(没有别的).我创建了以下基本的Gulpfile来编译我的Sass:

Gulpfile.js

var gulp = require('gulp'),
    sass = require('gulp-ruby-sass');

gulp.task('styles', function() {
    return gulp.src('Content/sass_new/application.scss')
    .pipe(sass({ style: 'expanded', }))
    .pipe(gulp.dest('Content/css'))
});

gulp.task('watch', function() {
    gulp.watch('Content/sass_new/*', ['styles']);
})

gulp.task('default', ['styles']);
Run Code Online (Sandbox Code Playgroud)

在Windows Powershell中,我运行gulp命令,它输出以下内容:

[10:02:57] Using gulpfile C:\[path to]\gulpfile.js
[10:02:57] Starting 'styles'...
[10:02:57] gulp-ruby-sass: 'sass' is not recognized as an internal or external command,
operable program or batch file.
[10:02:57] Finished 'styles' after 316 ms
[10:02:57] Starting 'default'...
[10:02:57] Finished 'default' after 15 ?s
Run Code Online (Sandbox Code Playgroud)

我在这里错过了什么吗?我需要安装Ruby还是Sass?我想这样做,我需要一个Ruby命令提示符,而PowerShell将无法访问它.任何指导表示赞赏!

Bal*_*zar 11

是的,你需要安装RubySass开始gulp-ruby-sass工作.

首先下载Ruby安装程序,具体取决于您在此地址的规格.安装完成后,您应该在系统上安装它,并通过PowerShell简单的命令行访问.

之后,只需运行命令即可

gem install sass
Run Code Online (Sandbox Code Playgroud)

而且你已经完成了.