D
D
Dmitry Sergeevich2015-10-30 12:42:33
Sass
Dmitry Sergeevich, 2015-10-30 12:42:33

How to correctly include a file with mixins in the Gulp SASS compilation stream with a modular project structure?

Hello everyone, I recently redesigned my starter template. Made it modular. Now I have this:

SASS
   helpers
     _functions.scss
     _helpers.scss
     _functions.scss
     _mixins.scss
     _variables.scss

In order to use all this, in the some_page.scss file, I write imports in some_page.scss:
@import '../helpers/functions';
@import '../helpers/helpers';
@import '../helpers/mixins';
@import '../helpers/variables';

Frankly, this is a poor decision. When changing helpers, I need to reload Gulp in order for them to take effect so that the files recount the imports. Maybe there is some other way to slip them into the SASS compilation stream?
Right now I have 5 threads:
gulp.watch('./dev/sass/global/*.scss',   ['sass-global'])
gulp.watch('./dev/sass/layout/*.scss',   ['sass-layout'])
gulp.watch('./dev/sass/pages/*.scss',    ['sass-pages'])
gulp.watch('./dev/sass/features/*.scss', ['sass-features'])
gulp.watch('./dev/sass/helpers/*.scss',  ['sass-helpers'])

Each thread has its own compilation features, so combining them into one is not an option.
To put it more simply. I need to get rid of the import of the helpers folder in the rest of the .scss files. I don't need to compile the helpers folder anywhere. You need to make the task just read mixins, variables and functions.
Please tell me how to do all this in a human way !?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
Nikolai Shabalin, 2015-10-30
@CheckOneTwo

You need to configure the task so that it looks at the entire sass
Task folder

gulp.task('sass', function() {
 gulp.src('/dev/sass/**/*.scss')
  .pipe(sass())
  .pipe(gulp.dest('место куда должно компилится'))
});

Watch
Settings, of course substitute your own.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question