Gulp Lazy Minify - My First Gulp Plugin

I've been using gulp-usemin for some website projects. I like this plugin because I can have 1 code base for website in dev and production. I can reference all js and css in full-version while developing and use minified+bundled version for production.

However, some 3rd party js can get pretty big and if I reference the full-version, it might take a lot of time to minify. Most of them have already provided the minified-version and I can easily use it. But I still prefer the full-version during development.

I've been trying to find a gulp plugin that will minify js/css only when it's needed. My definition of "not needed to minify" is when:

  1. the source file is already minified
  2. There exists a minified version of the source file in the same directory

Unfortunately I can't find any. So I've decided to create my own plugin. I name it gulp-lazy-minify.
This is the first npm package I've ever published and I feel excited. Hopefully this package will be useful to anyone else

Abdurrachman Habibi

Read more posts by this author.