Code Monkey home page Code Monkey logo

Comments (4)

ben-eb avatar ben-eb commented on June 15, 2024

Works fine for me:

var postcss = require('gulp-postcss');
var uncss = require('gulp-uncss');
var gulp = require('gulp');

gulp.task('default', function () {
  return gulp.src('./fixture.css')
    .pipe(postcss([ require('postcss-size') ]))
    .pipe(uncss({html: ['./index.html']}))
    .pipe(gulp.dest('out'));
});

fixture.css:

h1, h2 {
  size: 50px;
}

index.html:

<html><body><h1>hello</h1></body></html>

output:

h1 {
  width: 50px;
  height: 50px;
}

from gulp-uncss.

codedbypaul avatar codedbypaul commented on June 15, 2024

Ok. After changing the source to a single css file it works.

Seems it doesn't like:

return gulp.src(config.development.css.src + {style,style.ie}.css

Turns out it's because the style.ie.css file was empty.

from gulp-uncss.

ben-eb avatar ben-eb commented on June 15, 2024

OK, no problem. I've added a check that will simply pass through the CSS when the file is empty; as uncss'ing an empty string should return an empty string and not a crash. 😄

It's available since 1.0.4.

from gulp-uncss.

codedbypaul avatar codedbypaul commented on June 15, 2024

Cool. :)

from gulp-uncss.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.