A
A
avprinciple2019-07-11 22:11:52
File systems
avprinciple, 2019-07-11 22:11:52

How to specify the path to any folder in Gulp?

function images() {
  return src(
    [
    'src/img/**/*.{jpg,jpeg,png,gif,svg}',
    'src/blocks/**/img/*.{jpg,jpeg,png,gif,svg}'
    ])

   .pipe(dest('dist/img'));

There are, for example, blocks/login/img and blocks/footer/img
folders. It is necessary that from these folders, and any that are inside blocks, pictures are also picked up, copied to dist/img
'src/blocks/**/img/*.{jpg,jpeg,png,gif,svg}' - this is picked up, but takes all subfolders with it , only pictures in the corresponding folder are needed

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
avprinciple, 2019-07-12
@avprinciple

.pipe(rename({
    dirname: "/",
  }))
  .pipe(dest('dist/img'));

It works, but if there are other folders inside the img folder, for example icons src/img/icons , then it will not be picked up, the source folder will be img , not img/icons

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question