jonkemp / gulp-useref

Parse build blocks in HTML files to replace references to non-optimized scripts or stylesheets.
MIT License
705 stars 93 forks source link

gulp-useref deep folders error #209

Closed huanxijiuhao closed 8 years ago

huanxijiuhao commented 8 years ago

While execute gulp task with gulp-useref with deep folders, throw Error. But if i delete test folder, no error happend. Is anybody has any ideas?

throw new Error('Invalid glob argument:' + glob);
Error: Invalid glob argument:
    at Object.src(.....\node_modules\gulp-useref\node_modules\vinyl-fs\lib\src\index.js:32:11)
    at D:\Project\community\auto-community\src\main\webapp\WEB-INF\public\node_modules\gulp-useref\lib\streamManager.js:142:47
    at Array.forEach (native)

My situation

project directory
Project
  --app
      --html
         --a.html
         --test
            --b.html
      --css
      --js
  --dist
     --html
     --js
     --css

code

var gulp = require('gulp');
var useref = require('gulp-useref');
var cssnano = require('gulp-cssnano');
var uglify = require('gulp-uglify');
var gulpIf = require('gulp-if');
gulp.task('default', function(){
    return gulp.src('app/**/*.html')
        .pipe(useref())
        .pipe(gulpIf('*.js', uglify()))
        .pipe(gulpIf('*.css', cssnano()))
        .pipe(gulp.dest('dist'))
});
huanxijiuhao commented 8 years ago

Sorry, It's my own problem. And I have solved this problem. The reason of this error is that I add a script which src attribute is from http in task.