N
N
Nastyuuuushka2016-07-27 08:12:14
gulp.js
Nastyuuuushka, 2016-07-27 08:12:14

Why can't Gulp see the Img folder?

var gulp = require('gulp'),
    concatCSS = require('gulp-concat-css'),
    rename = require('gulp-rename'),
    autoprefixer = require('gulp-autoprefixer'),
    minifyCSS = require('gulp-minify-css'),
    stylus = require('gulp-stylus');

gulp.task('default', function() {
    gulp.src('development/*.css')
        .pipe(concatCSS("bundle.min.css"))
        .pipe(autoprefixer('last 50 version'))
        .pipe(minifyCSS())
        .pipe(gulp.dest('app/css'));
});

gulp.task('watch', function() {
    gulp.watch('development/*.css', ['default'])
})

gulp.task('stylus', function() {
  gulp.src('development/*.styl')
  .pipe(stylus())
  .pipe(gulp.dest('img/'));
});

zT89HGb2O5I.jpg

Answer the question

In order to leave comments, you need to log in

1 answer(s)
H
HamSter, 2016-07-27
@HamSter007

gulp.task('stylus', function() {
  gulp.src('development/*.styl')
  .pipe(stylus())
  .pipe(gulp.dest('img/'));
});

Here in dest
you are already compiling images!
But where do you want to get them from, if the source is gulp.src('development/*.styl') ... attach a .styl file, images are included there, if so, then the path is wrong?!
Or create another task specifically for images!
For example like this:
var gulp = require('gulp'),
    concatCSS = require('gulp-concat-css'),
    rename = require('gulp-rename'),
    autoprefixer = require('gulp-autoprefixer'),
    minifyCSS = require('gulp-minify-css'),
    stylus = require('gulp-stylus');

gulp.task('default', function() {
    gulp.src('development/*.css')
        .pipe(concatCSS("bundle.min.css"))
        .pipe(autoprefixer('last 50 version'))
        .pipe(minifyCSS())
        .pipe(gulp.dest('app/css'));
});

gulp.task('stylus', function() {
  gulp.src('development/*.styl')    // Откуда берете 
  .pipe(stylus())
  .pipe(gulp.dest('app/img'));              // Куда будете собирать
});

gulp.task('img', function() {
  gulp.src('development/*.img')                       // Откуда берете изображения
  .pipe(gulp.dest('img/'));               // Куда будете собирать
});

gulp.task('watch', function() {
    gulp.watch('development/*.css', ['css']);
   gulp.watch('development/*.styl', ['stylus']);
   gulp.watch('development/*.img', ['images']);
})

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question