T
T
topdetal2015-11-09 13:50:14
gulp.js
topdetal, 2015-11-09 13:50:14

Gulp-minify overrides concat-css, how to get both files?

Hello!
I connect the concat-css plugin - it works, then I connect the minify plugin - it also works and an already minified file is created; then I include rename to get the concat and .min file and I get only .min(((
Please tell me what I did wrong? How to get both bundle.css and bundle.min.css files?

var gulp = require('gulp'),
  concatCss = require('gulp-concat-css'),
  rename = require('gulp-rename'),
  notify = require('gulp-notify'),
  plumber = require('gulp-plumber'),
  minifyCss = require('gulp-minify-css');
  
 
gulp.task('default', function () {
  return gulp.src('css/**/*.css')
    .pipe(concatCss('css/bundle.css'))
  .pipe(plumber())
  .pipe(minifyCss())
  .pipe(rename('css/min/bundle.min.css'))
    .pipe(gulp.dest('app/'))
  .pipe(notify("Done!"))
});

gulp.task('watch', function () {
    gulp.watch('css/**/*.css', ['default']);
  })

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander Zachinalov, 2015-11-09
@SanDiesel

because the result of concat also needs to be put somewhere, just specifying the path instead of the file name is not enough. From the whole task, you give the result only for .min (.pipe(gulp.dest('app/'))), that's why it's the only one, do the same for the general file... I'm actually surprised why you and this code works, in theory, in the plugin call options, you can specify only the name of the output file, and not the path (i.e. just bundle.css, not css/bundle.css), but it's possible that the plugin itself cuts off the excess, so without bugs passes.

T
topdetal, 2015-11-09
@topdetal

Do you mean .pipe(gulp.dest(' ')) should be written after each command that involves creating files?
"I'm actually surprised why this code works for you, in theory, in the plugin call options, you can only specify the name of the output file, and not the path (that is, just bundle.css, not css/bundle.css), but it's possible, the plugin itself cuts off the excess, so it passes without bugs. "
But then how do I specify where I want to put the resulting file?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question