hughsk / vinyl-map

Map vinyl files' contents as strings
MIT License
36 stars 7 forks source link

Simplify example #1

Closed shama closed 10 years ago

shama commented 10 years ago

I saw that uglify was used twice in the readme example, once as a var and again as a function. So I updated to:

var uglify = require('uglify-js')
var map = require('vinyl-map')
var gulp = require('gulp')

gulp.task('minify', function() {
  return gulp.src('index.js')
    .pipe(minify)
    .pipe(gulp.dest('./dist'))
})

var minify = map(function(code, filename) {
  return uglify.minify(code, { fromString: true })
})

But thought it could even be simpler with the proposed changes. Cheers!

hughsk commented 10 years ago

Nice catch, thanks @shama! :)