如何将Compass,Sass实施到node.js项目? [英] How to implement Compass, Sass to a node.js project?
问题描述
我最近在我的Node.js项目上实现了grunt任务运行器,并且我正在使用grunt-contrib-compass和grunt-contrib-watch,以便在我进行任何更改时通过grunt编译我的sass和指南针代码.
i have recently implemented the grunt task runner on my Node.js project and i'm using grunt-contrib-compass and grunt-contrib-watch in order to compile my sass and compass code through grunt whenever i make any changes.
我的咕unt声文件是这样的:-
My grunt file is like this:-
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
compass: {
dist: {
options: {
sassDir: 'public/sass',
cssDir: 'public/css'
}
}
},
watch: {
css: {
files: '**/*.scss',
tasks: ['compass']
}
}
});
grunt.loadNpmTasks('grunt-contrib-compass');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.registerTask('default',['watch']);
}
我正在使用Windows,每当我运行grunt时,它都会监视我的sass文件,但是每当我对这些文件进行更改时,都会出现此错误:-
I'm using windows and whenever i run grunt it watches for my sass files but whenever i make a change to these files i get this error:-
Warning: Couldn't find the 'compass.bat' binary. Make sure it's installed and in you $PATH Use --force to continue
我已经通过ruby命令提示符安装了ruby和指南针,指南针的版本是1.0.3,gem安装程序的版本是2.4.6.我还尝试将c:\ Ruby200 \ bin包含到我的环境变量中,是的,在我的Node.js项目中安装了grunt-contrib-compass.我已经尝试了所有方法,如果有任何其他经验,我希望收到您的来信.非常感谢.
I have installed ruby and compass through the ruby command prompt and the compass version is 1.0.3 and my gem installer version is 2.4.6. I have also tried including c:\Ruby200\bin to my Environmental variables and yes grunt-contrib-compass is installed in my Node.js project. I have tried everything, if anyone else has any experience in this i would love to hear from you. Thanks a lot.
推荐答案
您只需要安装Ruby 并请按照以下步骤操作:
You just need to install Ruby and follow this steps:
-
npm install grunt-contrib-compass
- 使用选中的所有复选框重新安装Ruby gem installer 1.9.3
- 在ruby控制台上-
gem install sass
- 在ruby控制台上-
gem install compass
npm install grunt-contrib-compass
- Reinstall Ruby gem installer 1.9.3 with checked all checkbox
- On ruby console -
gem install sass
- On ruby console -
gem install compass
这篇关于如何将Compass,Sass实施到node.js项目?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!