gitarizd
@gitarizd
Верстальщик

Почему gulp не создает и не редактирует файлы, хотя в консоли watch и build — таски работают нормально?

'use strict';

var gulp = require('gulp'),
    watch = require('gulp-watch'),
    jade = require('gulp-jade'),
    stylus = require('gulp-stylus'),
    prefixer = require('gulp-autoprefixer'),
    uglify = require('gulp-uglify'),
    rigger = require('gulp-rigger'),
    cssmin = require('gulp-minify-css');

var path = {
    build: {
        html: 'build/',
        js: 'build/js/',
        css: 'build/css/',
        img: 'build/img/',
        fonts: 'build/fonts/'
    },
    src: {
        jade: 'src/*.jade', 
        js: 'src/js/main.js',
        style: 'src/style/main.styl',
        img: 'src/img/**/*.*',
        fonts: 'src/fonts/**/*.*'
    },
    watch: { 
        jade: 'src/**/*.jade',
        js: 'src/js/**/*.js',
        style: 'src/style/**/*.styl',
        img: 'src/img/**/*.*',
        fonts: 'src/fonts/**/*.*'
    },
    clean: './build'
};

gulp.task('html:build', function() {
 
  gulp.src(path.src.jade)
    .pipe(jade({
      pretty: true
    }))
    .pipe(gulp.dest(path.build.html))
});

gulp.task('js:build', function () {
    gulp.src(path.src.js) 
        .pipe(rigger()) 
        .pipe(uglify()) 
        .pipe(gulp.dest(path.build.js)); 
});

gulp.task('style:build', function () {
  gulp.src(path.src.style)
    .pipe(stylus())
    .pipe(prefixer({ browsers: ['last 25 versions'] }))
    .pipe(gulp.dest(path.build.css));
});

gulp.task('fonts:build', function() {
    gulp.src(path.src.fonts)
        .pipe(gulp.dest(path.build.fonts))
});

gulp.task('build', [
    'html:build',
    'js:build',
    'style:build',
    'fonts:build'
]);

gulp.task('watch', function(){
    watch([path.watch.jade], function(event, cb) {
        gulp.start('html:build');
    });
    watch([path.watch.style], function(event, cb) {
        gulp.start('style:build');
    });
    watch([path.watch.js], function(event, cb) {
        gulp.start('js:build');
    });
    watch([path.watch.fonts], function(event, cb) {
        gulp.start('fonts:build');
    });
});

gulp.task('default', ['build', 'watch']);


---

Acer@ACER-ПК Z:\home\csssr
$ gulp
[21:20:58] Using gulpfile Z:\home\csssr\gulpfile.js
[21:20:58] Starting 'html:build'...
[21:20:58] Finished 'html:build' after 12 ms
[21:20:58] Starting 'js:build'...
[21:20:58] Finished 'js:build' after 5.35 ms
[21:20:58] Starting 'style:build'...
[21:20:58] Finished 'style:build' after 5.61 ms
[21:20:58] Starting 'fonts:build'...
[21:20:58] Finished 'fonts:build' after 1.16 ms
[21:20:58] Starting 'build'...
[21:20:58] Finished 'build' after 15 μs
[21:20:58] Starting 'watch'...
[21:20:58] Finished 'watch' after 15 ms
[21:20:58] Starting 'default'...
[21:20:58] Finished 'default' after 13 μs

===
Решения из похожих вопросов не подходят
  • Вопрос задан
  • 338 просмотров
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы