Answer the question
In order to leave comments, you need to log in
Why does gulp not create or edit files, although in the watch and build console - tasks work fine?
'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']);
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question