estou tentando fazer o usemin funcionar, não consigo achar o erro, ele simplesmente não faz o replace da tag script, não concatena e minifica mais ambos: css,js, quando eu estava usando os modulos separados estava funcionando, alguem poderia me ajudar? e nao da erro algum quando executo o npm run gulp:
const 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');
gulp.task('default', ['copy'], function () {
gulp.start('build-img', 'usemin')
});
gulp.task('copy', ['clean'], function () {
gulp.src('site/**/*')
.pipe(gulp.dest('dist'));
});
gulp.task('clean', function () {
return gulp.src('dist')
.pipe(clean());
});
gulp.task('build-img', function () {
return gulp.src('site/images/**/*')
.pipe(imagemin())
.pipe(gulp.dest('dist/images'));
});
gulp.task('usemin', function () {
gulp.src('dist/**/*.php')
.pipe(usemin({
'js' : [uglify],
'css' : [cssmin]
}))
.pipe(gulp.dest('dist'));
});
termina:[14:25:52] Using gulpfile ~\tempo\Desktop\sites\allPort\gulpfile.js
[14:25:52] Starting 'clean'...
[14:25:53] Finished 'clean' after 402 ms
[14:25:53] Starting 'copy'...
[14:25:53] Finished 'copy' after 3.4 ms
[14:25:53] Starting 'default'...
[14:25:53] Starting 'build-img'...
[14:25:53] Starting 'usemin'...
[14:25:53] Finished 'usemin' after 76 ms
[14:25:53] Finished 'default' after 90 ms
[14:25:59] gulp-imagemin: Minified 259 images (saved 650.82 kB - 5.5%)
[14:25:59] Finished 'build-img' after 6.65 s
packet.json:
{
"name": "allPort",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"gulp": "gulp"
},
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
"gulp": "^3.9.0",
"gulp-clean": "^0.3.1",
"gulp-concat": "^2.6.0",
"gulp-cssmin": "^0.2.0",
"gulp-html-replace": "^1.5.4",
"gulp-imagemin": "^2.3.0",
"gulp-uglify": "^1.4.1",
"gulp-usemin": "^0.3.14"
}
}