Está atualizando porém tenho que clicar f5
var gulp = require('gulp'),
imagemin = require('gulp-imagemin'),
clean = require('gulp-clean'),
concat = require('gulp-concat'),
htmlreplace = require('gulp-html-replace'),
uglify = require('gulp-uglify')
,usemin = require('gulp-usemin')
,cssmin = require('gulp-cssmin')
,browserSync = require('browser-sync');
gulp.task('default', ['copy'], function() {
gulp.start('build-img', 'usemin');
});
gulp.task('copy', ['clean'], function() {
return gulp.src('src/**/*')
.pipe(gulp.dest('dist'));
});
gulp.task('clean', function() {
return gulp.src('dist')
.pipe(clean());
});
gulp.task('build-img', function() {
gulp.src('dist/img/**/*')
.pipe(imagemin())
.pipe(gulp.dest('dist/img'));
});
gulp.task('usemin', function() {
return gulp.src('dist/**/*.html')
.pipe(usemin({
js: [uglify],
css: [cssmin]
}))
.pipe(gulp.dest('dist'));
});
gulp.task('server', function() {
browserSync.init({
server: {
baseDir: 'src'
}
});
gulp.watch('src/**/*').on('change', browserSync.reload);
});
{
"name": "projeto",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"gulp": "gulp"
},
"author": "",
"license": "ISC",
"devDependencies": {
"browser-sync": "^2.9.8",
"gulp": "^3.9.0",
"gulp-clean": "^0.3.1",
"gulp-concat": "^2.6.0",
"gulp-cssmin": "^0.1.7",
"gulp-html-replace": "^1.5.4",
"gulp-imagemin": "^2.3.0",
"gulp-uglify": "^1.4.1",
"gulp-usemin": "^0.3.14"
}
}