stephenlacy/gulp-stylus

Problems with stylus + concat + imports

Closed this issue · 3 comments

I've got follow gulp-task:

gulp.src(['./**/*.styl', '!./**/_*.styl'], { base: process.cwd() });
    .pipe(sourcemaps.init())
    .pipe(stylus({
        'include css': true
    }))
    .pipe(postcss(processors))
    .pipe(concat('main.css'))
    .pipe(sourcemaps.write())
    .pipe(gulp.dest('./dev/static/css/'))          

I'd like to use imports in stylus-files. I have module fs like this:

markup/modules/footer/footer.styl
markup/modules/footer/_partial.styl

footer.styl has content

@import 'markup/modules/footer/_partial.styl';
.footer
    position absolute

_partial.styl has content

.parial
    position absolute

After compiling I have an error:

Error in plugin 'gulp-stylus'
Message:
    /Users/a.malko/Sites/tars/tars-master/markup/modules/footer/footer.styl:1:9
   1| @import 'markup/modules/footer/_partial.styl';
--------------^
   2|
   3| .footer
   4|     position absolute

failed to locate @import file markup/modules/footer/_partial.styl

Node 0.12
gulp-stylus 2.0.4
Task executed in /Users/a.malko/Sites/tars/tars-master

Can you create a test repo for me to clone and inspect?

@stevelacy I've fixed it by using

stylus({
    'include css': true,
    'resolve url': true
});

Is it correct?

Should be. If you are not including any css files then you do not need include css