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

Jade issue #203

Closed 3ilguun closed 8 years ago

3ilguun commented 8 years ago

I have near 50 jade templates. Which is almost ~35 .html file.

With useref task takes almost 30min. But without useref it takes ~30sec. Is there any issue with this task?

gulp.task('views', () => {
  return gulp.src('app/views/*.jade')
    .pipe($.plumber())
    .pipe($.jade({pretty: true}))
    .pipe(gulp.dest('.tmp'))
    .pipe(reload({stream: true}));
});

gulp.task('useref', ['views', 'styles', 'scripts'], () => {
  return gulp.src(['app/*.html', '.tmp/*.html'])
    .pipe($.useref({searchPath: ['.tmp', 'app', '.']}))
    .pipe($.if('*.js', $.uglify()))
    .pipe($.if('*.css', $.cssnano()))
    .pipe(gulp.dest('dist'));
});
jonkemp commented 8 years ago

What do you mean without useref? The two tasks are very different. The useref task has three prerequisite tasks that run before the task even runs.

3ilguun commented 8 years ago

What i mean is if i remove the useref pipe from the useref task then it will only take 30sec. But with the useref pipe it takes ~30min.

Is there any way around with jade template (jade layout template)? Without searching in compiled thousands of .html files?

I saw useref has jade support. But doesn't work.

windows 10 npm -v 2.11.3 gulp -v CLI version 1.2.1 Local version 3.9.1

jonkemp commented 8 years ago

Well, the tests pass, so how does it not work?

3ilguun commented 8 years ago

Sorry, I've mistyped in my jade template.

// build:css styles/vendor.css
// endbuild

should be

//- build:css styles/vendor.css -->
//- endbuild-->