i newbie gulp , gulp-compass. imho, gulp-compass doesn't work in gulp's stream paradigm.
normally, gulp's task should like:
gulp.src('path/to/src') .pipe(dosth) .pipe(gulp.dest('path/to/dist'));
but following code works gulp-compass:
gulp.src('') // <-empty source ok .pipe(compass({ css: 'path/to/dist/css' // <- output dir scss: 'path/to/src/scss' // <- input scss file glob })); // no dest needed!
this results in following problem.
|- dist |- scss |- app.scss |- css |- bootstrap.css
i want use gulp-compass
compile app.scss
app.css
, bundle app.css
bootstrap.css
, minify , output app-release.css
.
i want finish task in one gulp.task
.
function buildcss(inputstream) { // minify , output dist. return inputstream .pipe(cssnano()) .pipe(gulp.dest('dist')); } gulp.task('css-build', function() { var stream = gulp.src('scss/app.scss') .pipe(compass({ css: 'css', sass: 'scss' })) .pipe(gulp.src('css/*.css')); // <-- **here** return buildcss(stream); });
however, compiled app.css file not included in stream of here.
what solution?
i fix problem using merge-stream.
gulp.task('css', function() { var scss = gulp.src('scss/*.scss') .pipe(compass({ css: 'css', sass: 'scss' })); var css = gulp.src('css/bootstrap.css'); var stream = merge(scss, css) .pipe(concat('app-release.css')); return buildcss(stream); });
Comments
Post a Comment