A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/clean-css/clean-css/issues/342 below:

Using clean-css directly in your gulp recipe · Issue #342 · clean-css/clean-css · GitHub

Hi guys,

I just want to share a gulp recipe to minify css using the CleanCSS library, with the help of vinyl-map (a really useful library by @hughsk that you can use adapt most nodejs modules to work into your gulp streams)

var gulp = require('gulp');
var CleanCSS = require('clean-css');
var map = require('vinyl-map');

gulp.task('minify-css' , function minifyCSSTask() {
  // this snippet basically replaces `gulp-minify-css`
  var minify = map(function (buff, filename) {
    return new CleanCSS({
      // specify your clean-css options here
    }).minify(buff.toString());
  });

  return gulp.src('css/**/*.css')
    .pipe(minify)
    .pipe(gulp.dest('dist'));
});

This helps to reduce the need for a gulp-plugin wrapping around clean-css and allows you to use clean-css outside of your gulpfile.js


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4