gulpgulp-minify

Gulp replace files with minified


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?


Solution

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

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