J
J
jedybeavis2017-03-06 11:50:22
Sprites
jedybeavis, 2017-03-06 11:50:22

Stylus - failed to locate @import file sprites.styl?

There is a problem with compiling styles in Gulp
. First I make sprites, and then stylus. It gives an error that it cannot find the file. Most likely he does not have time to create it to connect it.

[10:49:36] CLI version 1.2.2
[10:49:36] Local version 4.0.0-alpha.2

gulp.task(project + '-spr', gulp.series(function generateSprites (done) {
        let timestamp = Date.now();
        let spriteOutput = gulp.src(srcFolder + 'images/sprites/*.png')
            .pipe(plumber({
                errorHandler: onError
            }))
            .pipe(sprite({
                imgName: "sprite.png",
                imgPath: "../img/sprite.png?" + timestamp,
                cssName: "sprites.styl",
                algorithm: 'binary-tree',
                padding: 10,
                retinaImgName: "sprite_retina.png",
                retinaImgPath: "../img/sprite_retina.png?" + timestamp,
                retinaSrcFilter: srcFolder + 'images/sprites/*@2x.png'
            }));
            
        spriteOutput.css
            .pipe(buffer())
            .pipe(plumber({
                errorHandler: onError
            }))
            .pipe(gulp.dest(srcFolder + 'styles/mixins'))
        spriteOutput.img
            .pipe(buffer())
            .pipe(plumber({
                errorHandler: onError
            }))
            .pipe(gulp.dest(folder + 'img'));
            
        done();
    }));
    allSprite.push(project + '-spr');

    gulp.task(project + '-styl', gulp.series(function generateStyl (done) {
        let mainStyl = '';
        fs.stat(srcFolder + 'styles/**/*-gulp.styl', function(err, stat) {
                mainStyl = gulp.src(srcFolder + 'styles/**/*-gulp.styl')
                .pipe(plumber({errorHandler: onError}))
                .pipe(buffer())
                .pipe(sourcemaps.init())
                .pipe(stylus({
                    use:[nib(),stylusFileExists()],
                    'include css': true,
                    include: [
                        normal.path
                    ]
                }))
                .pipe(sourcemaps.write('.'))
                .pipe(gulp.dest(folder + 'css/'))
                .pipe(browserSync.stream({match: '**/*.css'}));
        })
       done();
       return [mainStyl];
   }));
gulp.task(project + '-build', gulp.series(currentProject + '-spr', currentProject + '-styl')); //

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question