Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

gulp-clean-css

Package Overview
Dependencies
Maintainers
1
Versions
56
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gulp-clean-css

Minify css with clean-css.

  • 4.1.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
70K
decreased by-60.59%
Maintainers
1
Weekly downloads
 
Created

What is gulp-clean-css?

gulp-clean-css is a Gulp plugin for minifying CSS files using the clean-css library. It helps in reducing the size of CSS files by removing unnecessary whitespace, comments, and other redundant elements, which can improve the performance of web applications.

What are gulp-clean-css's main functionalities?

Basic Minification

This feature allows you to perform basic minification of CSS files. The code sample demonstrates how to set up a Gulp task to minify CSS files from the 'src' directory and output the minified files to the 'dist' directory.

const gulp = require('gulp');
const cleanCSS = require('gulp-clean-css');

gulp.task('minify-css', () => {
  return gulp.src('src/*.css')
    .pipe(cleanCSS({ compatibility: 'ie8' }))
    .pipe(gulp.dest('dist'));
});

Advanced Minification Options

This feature allows you to use advanced minification options provided by clean-css. The code sample shows how to set the 'level' option to 2 for more aggressive optimizations.

const gulp = require('gulp');
const cleanCSS = require('gulp-clean-css');

gulp.task('minify-css-advanced', () => {
  return gulp.src('src/*.css')
    .pipe(cleanCSS({ level: 2 }))
    .pipe(gulp.dest('dist'));
});

Source Maps

This feature allows you to generate source maps for the minified CSS files. The code sample demonstrates how to initialize and write source maps using the 'gulp-sourcemaps' plugin in conjunction with 'gulp-clean-css'.

const gulp = require('gulp');
const cleanCSS = require('gulp-clean-css');
const sourcemaps = require('gulp-sourcemaps');

gulp.task('minify-css-sourcemaps', () => {
  return gulp.src('src/*.css')
    .pipe(sourcemaps.init())
    .pipe(cleanCSS())
    .pipe(sourcemaps.write('.'))
    .pipe(gulp.dest('dist'));
});

Other packages similar to gulp-clean-css

Keywords

FAQs

Package last updated on 23 Apr 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc