I
I
Igor2020-08-18 22:32:44
gulp.js
Igor, 2020-08-18 22:32:44

How to disable converting images to base64 in gulp?

Here is my code

function stylusTask() {
  return src(path.stylus.src)
    .pipe(plumber())
    .pipe(sourcemaps.init())
    .pipe(stylus({
      use: nib(),
      import: ['nib'],
      compress: true
    }))
    .pipe(sourcemaps.write('.'))
    .pipe(dest(path.stylus.dest))
}


Why are base64 encoded images in the output css file?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Igor, 2020-08-26
@qud

Answer:
https://stackoverflow.com/questions/63477465/how-t...
The problem was two things:
1. you need to add a limit to the image weight:

function stylusTask() {
  return src(path.stylus.src)
    .pipe(plumber())
    .pipe(stylus({
      use: nib(),
      import: ['nib'],
      compress: true,
      define: {
        url: require('stylus').url({
          limit: 1
        })
      }
    }))
    .pipe(dest(path.stylus.dest))
}

2. Change version of gulp-stylus, I installed gulp-stylus 2.1.2 , was: gulp-stylus 2.7.0

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question