P
P
Peppa Pig2017-01-27 11:04:06
Preprocessors
Peppa Pig, 2017-01-27 11:04:06

Why doesn't @import work (gives an error) in gulp-stylus?

Doesn't work either via stylus API:

gulp.task('build:style', function (done) {
    gulp.src(path.app.style)
        //some pipe
        .pipe(stylus({
            import: ['app/blocks/common/mixins.styl'], 
            compress: true,
            'include css': true
        }))
        //some pipe
        .pipe(gulp.dest(path.build.style))
    done();
});

Not via the @ import directive in *.styl files directly.
Gives "failed to locate @ import fapp/blocks/common/mixins.styl"
It doesn't matter if the path is relative or absolute.
What am I doing wrong?
PS
There is no stylus tag...

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
Peppa Pig, 2017-01-27
@qbudha

So far I've found this workaround.
We collect all the files and do the concatenation.
The connection order in scr is important.
Because if you do not specify mixins ahead, then they may not be available.

gulp.src(['app/blocks/common/mixins.styl', 'app/blocks/**/*.styl'])
        .pipe(sourcemap.init())
        .pipe(concat('app.styl'))
        .pipe(stylus({
            compress: true,
            'include css': true
        }))
        //some pipe

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question