R
R
Rishat Sultanov2017-05-26 13:16:22
JavaScript
Rishat Sultanov, 2017-05-26 13:16:22

Why doesn't Gulp upload minified files?

Good afternoon :)
I'm trying to minify a js file.
Everything seems to be successful. But there is no file :(
gulpfile.js

var gulp = require('gulp');
var uglify = require('gulp-uglify');
var pump = require('pump');
 
gulp.task('compress', function (cb) {
  pump([
        gulp.src('/app/js/app.js'),
        uglify(),<code></code>
        gulp.dest('dist')
    ],
    cb
  );
});

Console
D:\Program\OpenServer\OpenServer\domains\gulpjs.local>gulp compress
[16:04:48] Using gulpfile D:\Program\OpenServer\OpenServer\domains\gulpjs.local\gulpfile.js
[16:04:48] Starting 'compress'...
[16:04:48] Finished 'compress' after 28 ms

D:\Program\OpenServer\OpenServer\domains\gulpjs.local>

Structure:
2ECA851f.jpg

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Pushkarev, 2017-05-26
@AXP-dev

Well, you have an app.js file and it is minified.
Here is a snippet from my code, it works as it should:

gulp.task('min', () => {
    gulp.src(variables.public.js + '/*.js')
        .pipe(uglify())
        .pipe(rename({suffix: '.min'}))
        .pipe(gulp.dest(variables.public.js));

    gulp.src(variables.public.css + '/*.css')
        .pipe(combineMq({
            beautify: false
        }))
        .pipe(rename({suffix: '.min'}))
        .pipe(gulp.dest(variables.public.css));
});

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question