I
I
Im p3l2017-04-23 20:39:45
JavaScript
Im p3l, 2017-04-23 20:39:45

How to compile and minify into one file in Gulp?

There is a `src/less-build-structure/` directory with a bunch of files and folders. How to collect all these files, including those in folders, into one file `est.min.css` Which is located in another directory `/build/est.min.css`
Here is my minification code:

var gulp = require('gulp'),
  uglify = require('gulp-uglify'),
  jshint = require('gulp-jshint'),
  concat = require('gulp-concat');

gulp.task('minify', function () {
  return gulp.src('.src/less-build-structure/**/*.*')
    .pipe(jshint())
    .pipe(jshint.reporter('default'))
    .pipe(uglify())
    .pipe(concat('.build/est.min.css'))
    .pipe(gulp.dest('build'));
});

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vladimir Kabysh, 2017-04-23
@v_kabish

Perhaps you are missing the minimization .
In general, it is better to use the approach described in the article - include all style files in one style.scss/less/styl and already minimize it, there is no need for gulp-concat.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question