gpt4 book ai didi

compass-sass - gulp-compass : You must compile individual stylesheets from the project directory 错误

转载 作者:行者123 更新时间:2023-12-04 12:47:41 26 4
gpt4 key购买 nike

我尝试运行 gulp 任务来编译我的 sass 项目,但是由于我创建了子文件夹 app/assets/并将我的源文件放入其中,我遇到了问题。在 sass 和 css 文件夹与我的 gulpfile 位于同一目录之前,它运行良好。如果我在我的基本目录上运行 compass watch 命令,我没有问题,这仅适用于 gulp-compass。

输出 :

Devnco: /Users/Devnco/Web/maquette ->gulp sass
[gulp] Using gulpfile ~/Web/maquette/gulpfile.js
[gulp] Starting 'sass'...
[gulp] Finished 'sass' after 6.12 ms
[gulp] You must compile individual stylesheets from the project directory.
[gulp] Plumber found unhandled error: [gulp] Error in plugin 'gulp-compass': Compass failed
[gulp] You must compile individual stylesheets from the project directory.
[gulp] Plumber found unhandled error: [gulp] Error in plugin 'gulp-compass': Compass failed
[gulp] You must compile individual stylesheets from the project directory.
[gulp] Plumber found unhandled error: [gulp] Error in plugin 'gulp-compass': Compass failed

我的 gulpfile.js :
var paths = {
css: './app/assets/css',
sass: './app/assets/sass/*.scss',
js: './app/assets/js',
images: './app/assets/images'
}

gulp.task('sass',function(){

gulp.src(paths.sass)
.pipe(plumber())
.pipe(compass({
css: paths.css,
sass: paths.sass
}))
.pipe(gulp.dest(paths.css))
.pipe(minifyCss())
.pipe(rename({ extname: '.min.css'}))
.pipe(gulp.dest(paths.css));
});

我的工作目录:
gulpfile.js
app/
assets/
fonts/
images/
sass/
css/
pages/
etc…

我的 package.json 和我使用的版本(最新)
"devDependencies": {
"gulp": "^3.6.2",
"gulp-compass": "^1.1.9",
"gulp-concat": "^2.2.0",
"gulp-minify-css": "^0.3.4",
"gulp-plumber": "^0.6.2",
"gulp-rename": "^1.2.0"
}

我进行了一些搜索,但仍未找到问题出在哪里。

提前致谢。

最佳答案

我今晚也遇到了这个问题。我通过更改我的 config.rb 路径来修复它。尝试

.pipe(compass({
config_file: './config.rb',
css: paths.css,
sass: paths.sass
}))

如果您没有/想要使用 config.rb,我相信您必须像在 https://www.npmjs.org/package/gulp-compass 的“加载没有 config.rb 的配置”部分中一样设置项目根目录|

关于compass-sass - gulp-compass : You must compile individual stylesheets from the project directory 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23826572/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com