Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gulp: Compile Stylus and concat with pure CSS

Tags:

css

gulp

stylus

I have a bunch of Stylus files in './styles/stylus/**.styl' and a bunch of CSS files in './styles/css/**.css'.

How do I use Gulp to compile the Stylus files, concat the result with all of the CSS files and output it to './styles/out.css'?

like image 856
damd Avatar asked Sep 11 '14 13:09

damd


1 Answers

You can use gulp-filter like:

var gulp   = require('gulp');
var stylus = require('gulp-stylus');
var concat = require('gulp-concat');
var Filter = require('gulp-filter');

gulp.task('css', function () {

    var filter = Filter('**/*.styl', { restore: true });

    return gulp.src([
            './styles/stylus/**.styl',
            './styles/css/**.css'
        ])
        .pipe(filter)
        .pipe(stylus())
        .pipe(filter.restore)
        .pipe(concat('out.css'))
        .pipe(gulp.dest('./styles'));
});
like image 65
coma Avatar answered Sep 20 '22 08:09

coma