Home >Web Front-end >HTML Tutorial >使用gulp-uncss清理多余无用css_html/css_WEB-ITnose

使用gulp-uncss清理多余无用css_html/css_WEB-ITnose

WBOY
WBOYOriginal
2016-06-24 11:15:111480browse

 

cnpm 也可以使用npm

cnpm install gulp-uncss --save-dev

 

gulpfile.js

var gulp = require('gulp'),    uncss = require('gulp-uncss');gulp.task('uncss', function() {    gulp.src('src/css/origin.css')   //冗余css文件        .pipe(uncss({            html: ['src/origin.html']  //使用css的html页面,可多个        }))        .pipe(gulp.dest('build/css/uncss')); //输出目录});

 

挺简单得就去除多余无用的css,再也不用css usage自己手动搞。

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn