Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jade layout option? #204

Open
3ilguun opened this issue Apr 26, 2016 · 1 comment
Open

Jade layout option? #204

3ilguun opened this issue Apr 26, 2016 · 1 comment

Comments

@3ilguun
Copy link

3ilguun commented Apr 26, 2016

When using jade useref reads all the compiled .html files instead of only reading the layout template. And because of that compile time takes too long (~30min).

I've ended up writing tons of tasks solving this problem.

...
gulp.task('copy:jade', () => {
  return gulp.src('app/views/layouts/*.jade')
    .pipe(gulp.dest('app/views/tmp'));
});
gulp.task('clean:jade', () => {
  return gulp.src(['dist/*jade', 'app/views/tmp'], {read: false})
    .pipe($.clean());
});
gulp.task('useref', ['sass', 'copy:jade'], () => {
  return gulp.src('app/views/layouts/*.jade')
    .pipe($.useref({searchPath: ['.tmp', 'app']}))
    .pipe(gulp.dest('dist'));
});
gulp.task('move:jade', ['useref'], () => {
  return gulp.src('app/views/tmp/*.jade')
    .pipe(gulp.dest('app/views/layouts'));
});
gulp.task('jade:move', () => {
  return gulp.src('dist/*.jade')
    .pipe(gulp.dest('app/views/layouts'));
});
...

What i'm doing here is:

  1. Compiling layout to dist
  2. Replace the original layout with compiled layout
  3. Run jade build with compiled layout
  4. Replace the original layout with backup layout

With this build time reduced from 30min to 10sec.

So is there any better way or simplify theyse tasks?

@jonkemp
Copy link
Owner

jonkemp commented May 5, 2016

Could be an issue with gulp-useref internally but not one that is currently known or easily fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants