R
R
Roman Tishakov2016-02-12 15:35:39
Sass
Roman Tishakov, 2016-02-12 15:35:39

How to add a folder with the specified name before the saved file?

There is an approximate file structure in the project:

_SRC
__JS
__IMG
__SASS
___LAYOUT1
____default.scss
____home.scss
___LAYOUT2
____default.scss
____home.scss
...

How do I make it so that the file is nested in the "css" folder, an example of the structure:
_PRODUCTION
__ASSETS
___LAYOUT1
____JS
____IMG
____css
_____default.css
_____home.css
___LAYOUT2
____JS
____IMG
____css
_____default.css
_____home.css
...

This code does not work (files are not written, although there are no errors):
gulp.task('Sass', function () {
    gulp.src('./SRC/SASS/**/*.scss')
        .pipe(dest(':folder/:name.css', {folder: 'css'}))
        .pipe(gulp.dest('./PRODUCTION/ASSETS/'));
   });

According to the documentation, everything is correct, TYC

Answer the question

In order to leave comments, you need to log in

2 answer(s)
R
Roman Tishakov, 2016-02-15
@BigRoma

In general, I figured it out myself, if anyone needs it, then here is the solution:

// Подключаем rename
var rename = require("gulp-rename");

.pipe(rename(function (path) {
  // В условии можно исключать папки, если необходимо 
  if(path.dirname.split("\\").pop()!=="themes"){
    // Добавляем путь
    path.dirname += "/css";
  }
})

PROFIT!

A
Alexander Zachinalov, 2016-02-12
@SanDiesel

he may not like the fact that the array of files to be processed is implicitly specified (./SRC/SASS/**/*.scss), try replacing with
and check if it starts working

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question