Gulp Task - Compile Stylus for CSS

Asked

Viewed 151 times

3

After a lot of fighting, I started making the page of my portfolio. I took the opportunity to use a few things I was learning, among them the Gulp and Stylus. For the construction of CSS I am using the methodology (I understand as architecture) ITCSS. However, at the time of executing the Gulp task I am getting some errors.

I have already updated the version of Gulp and Node.

My task at the Gulp

//Importa os módulos necessários para o Gulp, inclusive ele mesmo
var gulp = require( 'gulp' );
var concatCss = require('gulp-concat-css');
var stylus = require('gulp-stylus');
var minifyCss = require('gulp-minify-css');

//Tarefa para compilar, concatenar e comprimir o css
gulp.task('css', function() {
    return gulp.src('src/styl/*.styl')
        .pipe(stylus())
        .pipe(concatCss("style.css"))
        .pipe(minifyCss({compatibility: 'ie8'}))
        .pipe(gulp.dest('dist/css/'));
});

In my base.styl I have the code below:

body
  background-color: red

In my settings.styl:

/*====================
 *=====Variáveis
 *====================/

//Cores
$color-white: #fff

//Media Queries
media_queries = {
  thin-mobile: "only screen and (min-width: 320px)",
  medium-mobile: "only screen and (min-width: 480px)",
  large-mobile: "only screen and (min-width: 600px)",
  tablet: "only screen and (min-width: 768px)",
  deskto: "only screen and (min-width: 900px)"
}

It is not parsing my Stylus code. When executing the task I get:

Potentially unhandled rejection[2] Error: No writecb in Transform Class

inserir a descrição da imagem aqui

If I only have the file base.styl he parses normally. But then with the settings.styl in the middle already gives the error.

1 answer

0


The resolution was super simple. I forgot to stick to one detail: how are declared variables in Stylus.

Like I did

$myVar : #fff

How do

$myVar = #fff

or

myVar = #fff

Browser other questions tagged

You are not signed in. Login or sign up in order to post.