stephenlacy / gulp-stylus

Stylus plugin for gulp
MIT License
223 stars 60 forks source link

Problems with stylus + concat + imports #144

Closed artem-malko closed 9 years ago

artem-malko commented 9 years ago

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

stephenlacy commented 9 years ago

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

artem-malko commented 9 years ago

@stevelacy I've fixed it by using

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

Is it correct?

stephenlacy commented 9 years ago

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