Sergei Basharov
Sergei Basharov

Reputation: 53850

Make Stylus merge imported CSS into the stylesheet

I have a Stylus file, looking like

@import init
@import typography
@import colors
@import 'components/*'

@import '3rdparty-stylesheet.css'

The last line is a CSS file I get from a 3rd party plugin which I want not just to stay as it is when compiled into CSS, but all the content of this file to be injected. I use Gulp.

How can I achieve it?

Upvotes: 7

Views: 3853

Answers (2)

Jamie Popkin
Jamie Popkin

Reputation: 179

For command line I use this.

stylus --include-css index.styl

Which I find handy for testing... before incorporating into the build process.

Upvotes: 5

Sergei Basharov
Sergei Basharov

Reputation: 53850

I have found how to switch this option on:

    gulp.src('./app/styl/style.styl')
    .pipe(stylus({
        'include css': true
    }))
    .pipe(gulp.dest('./dist/css'));

And it works like a charm now, puts all imported CSS contents into a single compiled file.

Upvotes: 10

Related Questions