ben-eb / gulp-uncss

DEPRECATED. Remove unused CSS selectors.
MIT License
939 stars 43 forks source link

TypeError Bad Argument #53

Closed OleVik closed 8 years ago

OleVik commented 8 years ago

I get an error saying:

TypeError in plugin 'gulp-uncss'
Message:
    Bad argument

With a fairly typical setup:

var gulp = require('gulp');
var plugins = require('gulp-load-plugins')({
    pattern: ['gulp-*'],
    lazy: true
});
    gulp.src(['app/css/app.scss'])
    .pipe(plugins.plumber())
    .pipe(plugins.sass({
        includePaths: [
        './app/vendor',
        './bower_components/bootstrap/scss',
        './bower_components/open-sans-fontface',
        './app/vendor/compass-sass-mixins/lib',
        './app/vendor/compass-sass-mixins/lib/css3',
        './node_modules/include-media/dist',
        './node_modules/modularscale-sass/stylesheets'
        ],
    }))
    .pipe(plugins.postcss([autoprefixer]))
    .pipe(plugins.concat('app.css'))
    .pipe(gulp.dest('public/css'))
    .pipe(plugins.uncss({
        html: ['public/**/*.html']
    }))
    .pipe(gulp.dest('public/css'))
    .pipe(plugins.rename({suffix: '.min'}))
    .pipe(plugins.cssnano())
    .pipe(gulp.dest('public/css'))

However, running through the UnCSS CLI it progresses as expected. This is with gulp-uncss@1.0.5 and uncss@0.13.0. The html-option seems correct enough, what could be causing the error?

ben-eb commented 8 years ago

Where is the origin of this error? Could you please provide a full stack trace?

OleVik commented 8 years ago

I'm not quite sure how to obtain a full stack trace, would the equivalent from gulp-plumber work? Here is the output from its errorHandler (slightly formatted for readability):

{ [TypeError: Bad argument]
  name: 'TypeError',
  message: 'Bad argument',
  stack: 'TypeError: Bad argument
at TypeError (native)
at ChildProcess.spawn (internal/child_process.js:274:26)
at Object.exports.spawn (child_process.js:362:9)
at node_modules\\phridge\\lib\\spawn.js:103:38
at init (node_modules\\when\\lib\\makePromise.js:39:5)
at new Promise (node_modules\\when\\lib\\makePromise.js:27:53)
at Function.promise (node_modules\\when\\when.js:97:10)
at startPhantom (node_modules\\phridge\\lib\\spawn.js:73:25)
at tryCatchReject (node_modules\\when\\lib\\makePromise.js:845:30)
at runContinuation1 (node_modules\\when\\lib\\makePromise.js:804:4)
at Fulfilled.when (node_modules\\when\\lib\\makePromise.js:592:4)\n
   at Pending.run (node_modules\\when\\lib\\makePromise.js:483:13)
at Scheduler._drain (node_modules\\when\\lib\\Scheduler.js:62:19)
at Scheduler.drain (node_modules\\when\\lib\\Scheduler.js:27:9)
at nextTickCallbackWith0Args (node.js:452:9)
at process._tickCallback (node.js:381:13)',
  showStack: false,
  showProperties: true,
  plugin: 'gulp-uncss' }
ben-eb commented 8 years ago

Okay. Looks like this is a duplicate of this bug; https://github.com/giakki/uncss/issues/75