Gulp 似乎找不到 compass mixin [英] Gulp can't seem to find compass mixins
问题描述
我正在尝试将 gulp 作为 Grunt 的替代构建工具,将我的 scss 编译为 css,因为我听说它可以更快.
I am trying out gulp as an alternative build tool to Grunt, to compile my scss to css, as I have heard it can be much faster.
我什至在对我的 scss 文件进行基本编译时都遇到了问题.我曾尝试使用 gulp-sass、gulp-ruby-sass 和 gulp-compass 插件进行 gulp,但我得到了几乎相同的错误每次留言:
I having problems doing even a basic compile of my scss files. I have tried using the gulp-sass, gulp-ruby-sass and gulp-compass plugins for gulp and I get pretty much the same error message every time:
error screen.scss (Line 2 of _grid.scss: Undefined mixin 'box-sizing'.)
所以看起来它一碰到指南针 mixin 就会掉下来.我的电脑上安装了 ruby,compass 版本 1.0.0.alpha.19 和 sass 版本 3.3.7.
So it looks like it is falling down as soon as it hits a compass mixin. I have ruby installed on my PC with compass version 1.0.0.alpha.19 and sass version 3.3.7.
这是我的 gulpfile:
Here is my gulpfile:
var gulp = require('gulp'),
compass = require('gulp-compass'),
sass = require('gulp-ruby-sass');
gulp.task('compass', function() {
gulp.src('../sass/UK/screen.scss')
.pipe(compass({
css: '../css',
sass: '../sass',
sourcemap: true,
style: 'compressed'
}))
.pipe(gulp.dest('../css/UK/screen.css'));
});
gulp.task('sass', function () {
gulp.src('../sass/UK/**/*.scss')
.pipe(sass({ style: 'compressed', sourcemap: true }))
.pipe(gulp.dest('../css/UK'));
});
我知道如何告诉它我的指南针副本安装在哪里吗?我以为它是全局安装的.
Any ideas how I tell it where my copy of compass is installed? I thought it was installed globally.
推荐答案
没错,compass
应该在你的系统上全局安装才能完成这项工作,至少很容易.我建议你卸载 sass 和 compass 以使用
You right, compass
should be installed globally on your system to get this work, at least easily. I recommend you to uninstall sass and compass to get something clean using
gem uninstall sass && gem uninstall compass
然后重新安装它们:
gem install sass
gem install compass --pre
然后你可以像这样定义一个 gulp 任务
And after you can define a gulp task like so
gulp.task('compass', function () {
return gulp.src('../sass/UK/screen.scss')
.pipe(sass({ compass: true, sourcemap: true, style: 'compressed' }))
.pipe(gulp.dest('../css/UK/screen.css'));
});
这篇关于Gulp 似乎找不到 compass mixin的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!