Gulp replace files with minified

710 views Asked by At

I have the following tree structure

|-src
|--assets
|---script.js

and I want to replace the contents of script.js with their minified version of it WITHOUT renaming it into script-min.js.

The code right now is:

gulp.task('minifyjs',['movejs'],function(){
    return gulp.src('src/assets/sample.js',{base:'./'})
        .pipe(gulp_requires.minify())
        .pipe(gulp.dest('src/assets/'))
});

How should be modified in order to acheive that?

1

There are 1 answers

0
Dimitrios Desyllas On BEST ANSWER

Try to use gulp-uglify package instead of minify one.

https://www.npmjs.com/package/gulp-uglify