S
S
Sergey Goryachev2017-06-02 22:40:47
css
Sergey Goryachev, 2017-06-02 22:40:47

What is the mistake of the gallp task?

Greetings gentlemen.
There is a task:

// compile sass and css files
gulp.task('sass', function(){
    return gulp.src([
        '!assets/styles/_*.scss',
        'assets/styles/all.scss',
        'assets/styles/**/*.scss'
    ])
    .pipe(sourcemaps.init())
    .pipe(plumber())
  .pipe(sass().on('error', sass.logError))
    .pipe(sourcemaps.write('.'))
    .pipe(gulp.dest(path.join(content_path, 'css/')));
});

in fact, its task is:
1. ignoring files like _*.scss (for example, _reset.scss)
2. collect the all.scss file, in which other files are connected by import
@import "_fonts";
@import "_color";
@import "_base";
@import "_wrapper";

3. and then add all the other files that may or may not be in folders.
So that when assembling a css file, the order of connection is exactly the same.
First, the necessary "system" files, and then the design styles.
But gulp doesn't understand me :(

Answer the question

In order to leave comments, you need to log in

2 answer(s)
F
Froggyweb, 2017-06-02
@Froggyweb

And what is not happening?
there is no compilation order in tasks. it will take files from the array and process them
instead of

!assets/styles/_*.scss', и 'assets/styles/**/*.scss'

you can write front/styl/**/!(_)*.styl
all.scss you can also exclude why it does not fit the mask of the latterassets/styles/**/*.scss

E
Edward, 2017-06-03
@edalis

Why such difficulties in the task?
This:

'!assets/styles/_*.scss',
'assets/styles/all.scss',

no need, Gulp will not save files that start with an underscore anyway, and all.scss is included in the assets/styles/**/*.scss path
Here:
@import "_fonts";
@import "_color";
@import "_base";
@import "_wrapper";

no underscores needed, just:
@import "fonts";
@import "color";
@import "base";
@import "wrapper";

Gulp will understand)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question