gulp指南针创建一个不需要的文件,而不是仅使用流 [英] gulp compass creates an unwanted file instead of using only stream
问题描述
这是我的app-compass gulp任务:
var compass = require('gulp-compass');
var autoprefixer = require('gulp-autoprefixer');
gulp.task('app-compass',function(){
var stream = gulp.src('./ app / styles / index.scss')
。管道(指南针({
css:paths.css,
sass:'app / styles',
图片:'app / assets / images',
generated_images_path:paths.images
)))
.pipe(autoprefixer())
.pipe(gulp.dest(paths.css));
});
作为指南针的一部分,创建了一个index.css文件。这是一种不需要的操作。我只想要数据流而不写入文件。明天我可能会改变目的地,例如,我将不得不改变指南针的 css
属性。
有没有一种方法可以让我可以告诉指南针不要创建一个css文件,只通过流传递它?
指南针
和 gulp.dest
都创建 .css
文件。尝试删除 .pipe(gulp.dest(paths.css))
并确保 属性 compass
配置对象指向所需的目标位置。
更新来自原始海报的代码
gulp.task('app-compass',function(){
var stream = gulp.src('./ app / styles / index.scss' )
.pipe(指南针({
css:paths.css,
sass:'app / styles',
图片:'app / assets / images',
generated_images_path:paths.images
}))
.pipe(autoprefixer());
});
This is my app-compass gulp task:
var compass = require('gulp-compass');
var autoprefixer = require('gulp-autoprefixer');
gulp.task('app-compass', function() {
var stream = gulp.src('./app/styles/index.scss')
.pipe(compass({
css: paths.css,
sass: 'app/styles',
image: 'app/assets/images',
generated_images_path: paths.images
}))
.pipe(autoprefixer())
.pipe(gulp.dest(paths.css));
});
As part of compass, an index.css file created. This is an unwanted operation. I only want the data on the stream without write it to a file. Tomorrow I might change the destination and I'll have to change also the css
property of compass, for example.
Is there a way where I can tell compass not to create a css file and only pass it via the stream?
解决方案 It looks like compass
and gulp.dest
are both creating the .css
file. Try removing .pipe(gulp.dest(paths.css))
and ensuring the css
property of the compass
configuration object points to the desired destination location.
Updated Code from Original Poster
gulp.task('app-compass', function() {
var stream = gulp.src('./app/styles/index.scss')
.pipe(compass({
css: paths.css,
sass: 'app/styles',
image: 'app/assets/images',
generated_images_path: paths.images
}))
.pipe(autoprefixer());
});
这篇关于gulp指南针创建一个不需要的文件,而不是仅使用流的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!