css - Gulp - How To Get Parent Directory Name -


say have following website structure:

wwwroot ---- css -------- clienta ------------ styles.css -------- clientb -------- clientc  assets ---- sass -------- clienta ------------ styles.scss -------- clientb -------- clientc 

in gulp, want watch sass files in each of folders under "assets/sass" (clienta, clientb, clientc, etc.) , write compiled .css files corresponding client folder in wwwroot (same name).

so, i'm using gulp.watch watch changes sass client folders, , i'm thinking of using callback event.path determine file i'm saving:

gulp.watch(sasswatchfiles, function(event) {      // path of file we've saved     var file = event.path;      // determine name of parent directory     var parentdirectory = ????; // how this?      // call sass compile method (user-defined), passing in client directory name     compilesass(client);  }); 

in middle line of gulp.watch callback function, how parent directory?


Comments