Roland Pish
Roland Pish

Reputation: 815

Gulp jade not including parent directories

I've been using grunt for a while and I recently heard about gulp, so I wanted to give it a try and see if I can finally migrate from grunt to gulp. I created a very simple task that takes my .jade files in two separate directories and compiles them into html. The problem I'm facing right now is that the parent directory of the .jade files is not getting created in the output directory. The following is a portion of the gulpfile.js that contains the 'jade' task:

var gulp  = require('gulp'),
    $ = require('gulp-load-plugins')(),
    jadeOpts = { debug: false };

gulp.task('jade', function() {
  return gulp.src(['partial/**/*.jade','directive/**/*.jade'])
    .pipe($.jade(jadeOpts))
    .pipe(gulp.dest('dev/html')));
});

The task runs correctly but, the source .jade files within 'partial' are created on 'dev/html' directory instead of 'dev/html/partial'. The same happens for source .jade files within 'directive' folder.

How can I do to make this task create the source 'partial' .jade files into 'dev/html/partial' folder as well as source 'directive' .jade files into 'dev/html/directive' folder? Note: I may need to add more 'partial' and 'directive' siblings folders with .jade files as well.

Thanks in advance.

Upvotes: 1

Views: 512

Answers (1)

harishr
harishr

Reputation: 18065

change the .src part

return gulp.src(['partial/**/*.jade','directive/**/*.jade'], {'base' : 'partial/'})

so that the .dest will consider full path from partial dir while saving the files to dest

Upvotes: 1

Related Questions