Dimitoriosu Deshirasu
Dimitoriosu Deshirasu

Reputation: 39

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?

Upvotes: 1

Views: 725

Answers (1)

Dimitrios Desyllas
Dimitrios Desyllas

Reputation: 10032

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

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

Upvotes: 1

Related Questions