项目作者: rbtech

项目描述 :
CSS-PURGE now comes in a flavor thats meant to be Gulped
高级语言: JavaScript
项目地址: git://github.com/rbtech/gulp-css-purge.git
创建时间: 2017-12-22T09:16:03Z
项目社区:https://github.com/rbtech/gulp-css-purge

开源协议:MIT License

下载


gulp and CSS-PURGE

Gulp CSS-PURGE

Purges duplicate CSS rules and more. Based on css-purge.

You have an issue?

This is a simple gulp plugin, which means it’s a thin wrapper around css-purge. If you are having CSS issues, please contact css-purge. Please only create a new issue if it looks like you’re having a problem with the gulp plugin.

Install

  1. npm install gulp-css-purge --save-dev

Options

Visit the CSS-PURGE website

Example 1 - Multiple CSS files merged into single CSS file - Full Working Example

  1. var gulp = require('gulp'),
  2. concat = require('gulp-concat'),
  3. purge = require('gulp-css-purge');
  4. gulp.task('default', function() {
  5. return gulp
  6. .src(['./**/*.css']) //input css
  7. .pipe(concat('main.css')) //merge into single css file - remove if you want to process output into separate files
  8. .pipe(purge({
  9. trim : true,
  10. shorten : true,
  11. verbose : true
  12. }))
  13. .pipe(gulp.dest('build/css')) //output folder
  14. });

Example 2 - SASS

  1. var gulp = require('gulp'),
  2. sass = require('gulp-ruby-sass'),
  3. purge = require('gulp-css-purge'),
  4. minify = require('gulp-minify-css');
  5. gulp.task('default', function() {
  6. gulp.src(['./**/*.sass'])
  7. .pipe(sass())
  8. .pipe(purge())
  9. .pipe(gulp.dest('./public'));
  10. })

License

(The MIT License)

Copyright (c) 2017 Red Blueprint Technologies

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
‘Software’), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED ‘AS IS’, WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.