【发布时间】:2014-12-02 19:58:37
【问题描述】:
我尝试使用 grunt-contrib-sass 并收到错误:
You need to have Ruby and Sass installed and in your PATH for this task to work.
但我确定我已经安装了 Ruby 和 Sass。 我已经用下面的命令检查了它
ruby -v and receive 1.9.3p545
sass -v and receive 3.4.5
这样我就可以确定我已经安装了 Ruby 和 Sass。
但是当我使用时
grunt sass
我收到了那个错误。
请帮助我,我真的很感激。 对不起,我的英语不太好。
这是我的 package.json
{
"name": "TEST",
"version": "0.0.1",
"dependencies":
{
"grunt": "~0.4.5",
"grunt-contrib-sass": "~0.8.1"
}
}
这是 gruntfile.js
module.exports = function(grunt)
{
grunt.loadNpmTasks('grunt-contrib-sass');
grunt.initConfig
({
sass:
{
dist:
{
options:
{
style: 'compressed'
},//options
files:
{
'css/style.css': 'component/sass/style.scss'
}//files
}//dist
}//sass
})//initConfig
}//exports
【问题讨论】:
-
查看this answer,了解如何使用 grunt sass无需全局安装 Ruby 和 sass。