gulp-ruby-sass在Windows中不是公认的命令 [英] gulp-ruby-sass not a recognized command in Windows
问题描述
$ b Gulpfile.js
var gulp = require('gulp'),
sass = require('gulp-ruby-sass');
$ b 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']);
在Windows Powershell中,我运行 gulp
命令,并输出以下内容:
[10:02:57]使用gulpfile C:\ [path to] \\ \\ gulpfile.js
[10:02:57]启动'styles'...
[10:02:57] gulp-ruby-sass:'sass'不被识别为内部或外部命令,
可操作程序或批处理文件。
[10:02:57] 316 ms后完成'styles'
[10:02:57]启动'default'...
[10:02:57] Finished'default '15微秒后
我在这里错过了什么吗?我需要安装Ruby还是Sass?我想这样做,我需要一个Ruby命令提示符,PowerShell将无法访问它。任何指导意见!
是的,您需要安装 Ruby
和 Sass
以获得 gulp-ruby-sass
正在工作。
首先根据此地址的规格下载 Ruby
安装程序>。一旦安装完毕,你应该在你的系统上安装它,并可以通过 PowerShell
或者简单的命令行来访问。
只需运行命令
gem install sass
你完成了。
I'm trying out gulp for the first time on a Windows Server 2012 VM. I'm normally a Mac user, so I'm a bit new to Windows & Powershell for dev tools like this. I installed Node.js & npm (and nothing else). I created the following basic Gulpfile to compile my 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']);
In Windows Powershell, I run the gulp
command, and it outputs the following:
[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
Am I missing something here? Do I need to install Ruby or Sass? I thought to do that, I'd need a Ruby command prompt and PowerShell wouldn't have access to it. Any guidance is appreciated!
Yes that's right, you need to install Ruby
and Sass
to get gulp-ruby-sass
working.
Begin by download the Ruby
installer depending on your specs at this address. Once installed you supposed to have it on your system and accessible by PowerShell
or the simple command line.
After, just run the command
gem install sass
And you're done.
这篇关于gulp-ruby-sass在Windows中不是公认的命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!