How to rename a compiled sass file to a Gulp task

I am trying to write a simple gulp task that takes a scss file named manifest.scss and after compiling and minifying the file, it saves the result to the destination folder as app.css

The next task does almost everything I want by renaming the file (output is build / css / manifest.css)

gulp.task('sass', function() {
 gulp.src("src/sass/manifest.scss")
      .pipe(sass({ style: 'compressed' }))
      .pipe(minifyCSS())
      .pipe(gulp.dest('build/css'));
});

      

So, I tried gulp-rename and I updated the task like this:

gulp.task('sass',  function() {
 gulp.src("src/sass/manifest.scss")
      .pipe(sass({ style: 'compressed' }))
      .pipe(minifyCSS())
      .pipe(rename('app.css'))
      .pipe(gulp.dest('build/css'));
});

      

This creates a build / css / app.css file, but it is completely empty.

How do I rename a compiled file?

thank

+3


source to share





All Articles