S
S
sftp2016-07-01 17:37:56
css
sftp, 2016-07-01 17:37:56

How to configure Gulp to build CSS files without import files inside?

Toaster, hello!
Faced a problem. There is a project structure in which all files are in the styles folder , but inside there are also separate sub-folders for the site sections: admin , blog , pages , etc.
At the root of each such folder there is a main.css file, through which they are imported through @importfiles in the folder / subfolders, etc.
I would like Gulp to collect and put only main files in the necessary directories, but not touch what is imported.
The config is like this:

// Компиляция стилей
  gulp.task('styles', function () {
    return gulp.src('styles/**/*.sss', 'styles/admin/layout-admin.sss', 'styles/blog/layout-blog.sss')
      .pipe(plumber({errorHandler: errorHandler}))
      .pipe(postcss(processors, { parser: sugarss }))
      .pipe(rucksack())
      .pipe(rename(function (path) {
        suffix: "-min",
        path.extname = ".css";
        return path;
      }))
      .pipe(gulp.dest(paths.build.styles));
  });

But it builds the complete structure in the build folder. And after all, I want to set everything up so that when creating a new folder (= partition) there is no need to edit the config, and the watcher and handler hook and collect it all.
Tell me, please, who faced this and how did you win? Well, or where at least to dig? Where to look?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander, 2016-07-02
@2gud

Look here, it might help. https://jsfiddle.net/g9abxz3o/

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question