Running Gulp with Gulp without saving the folder structure

Today I started looking for gulp.js to compile my smaller files, etc.

I have this and it works with the task, but the compiled files are all in the same folder - not supporting the original hierarchy.

Is there a way to ensure that the output supports the original file structure?

I am new to gulp, so it may not do it right.

Here is my gulp file (part related to Less):

var sourceLess = 'app/assets/stylesheets/less'; var targetCss = 'public/css2'; // Compile Our Less gulp.task('less', function() { return gulp.src([sourceLess + '/my-bootstrap-theme.less', sourceLess + '/themes/*.less']) .pipe(less()) .pipe(minifyCss()) .pipe(gulp.dest(targetCss)); }); 

I would like Less files from the source themes folder to be placed in the destination themes folder. What options are I missing?

Do I need to run them as separate tasks?

thank

Update: I looked at the proposed post and changed my paths to this:

 gulp.src([sourceLess + '/**/my-bootstrap-theme.less', sourceLess + '/themes/**/*.less', sourceLess + '/responsive.less'], { base: 'sourceLess' }) 

I also changed the directory variables to this:

 var sourceLess = './app/assets/stylesheets/less'; var targetCss = './public/css2'; 

But it does not create the themes folder, I was expecting it.

+1
gulp gulp-less
Feb 22 '14 at 23:37
source share
2 answers

If you want to save subfolders, you must define the base in the parameters (2nd argument), for example, to save "assets / file.doc" to "dist /":

 gulp.src(["assets/file.doc"], {base: "."}) .pipe(gulp.dest("dist/")); 

check the link https://github.com/gulpjs/gulp/issues/151

greetings, chidan

+3
Dec 24 '14 at 10:50
source share

You need to use two threads

 var sourceLess = 'app/assets/stylesheets/less'; var targetCss = 'public/css2'; gulp.task('less', function() { // my-bootstrap-theme.less gulp.src(sourceLess + '/my-bootstrap-theme.less') .pipe(less()) .pipe(minifyCss()) .pipe(gulp.dest(targetCss)); // themes/*.less gulp.src(sourceLess + '/themes/*.less') .pipe(less()) .pipe(minifyCss()) .pipe(gulp.dest(targetCss + '/themes')); }); 
0
Feb 23 '14 at 16:15
source share



All Articles