jonkemp / gulp-useref

Parse build blocks in HTML files to replace references to non-optimized scripts or stylesheets.
MIT License
705 stars 93 forks source link

gulp-useref is not uglifying or minfying my js/css files #227

Closed francisngo closed 7 years ago

francisngo commented 7 years ago

When I switched computers, I didn't include my node_modules. When I tried to reinstall all my dependencies with npm install, everything looked fine but now when I try to minify my css and uglify my js into my dist folder, it doesnt work. I am not sure what happened, I tried to update to the latest gulp-useref and I am not getting any further errors/warnings other than (node:43165) DeprecationWarning: os.tmpDir() is deprecated. Use os.tmpdir() instead.

Here is my gulpfile.js:

var gulp = require('gulp'),
    browserSync = require('browser-sync').create(),
    del = require('del'),
    cache = require('gulp-cache'),
    cssnano = require('gulp-cssnano'),
    deploy = require('gulp-gh-pages'),
    gulpIf = require('gulp-if'),
    imagemin = require('gulp-imagemin'),
    sass = require('gulp-sass'),
    maps = require('gulp-sourcemaps'),
    uglify = require('gulp-uglify'),
    runSequence = require('run-sequence'),
    useref = require('gulp-useref');

gulp.task('useref', function() {
    return gulp.src('app/*.html')
    .pipe(useref())
    .pipe(gulpIf('*.js', uglify()))
    .pipe(gulpIf('*.css', cssnano()))
    .pipe(gulp.dest('dist'))
});

and my package.json:

  "author": "",
  "license": "ISC",
  "devDependencies": {
    "browser-sync": "^2.17.6",
    "del": "^2.2.2",
    "gulp": "^3.9.1",
    "gulp-cache": "^0.4.5",
    "gulp-cssnano": "^2.1.2",
    "gulp-gh-pages": "^0.5.4",
    "gulp-if": "^2.0.2",
    "gulp-imagemin": "^3.1.1",
    "gulp-sass": "^3.1.0",
    "gulp-sourcemaps": "^2.2.0",
    "gulp-uglify": "^2.0.0",
    "gulp-useref": "^3.1.2",
    "run-sequence": "^1.2.2"
  }
}

is anyone else having this issue?

francisngo commented 7 years ago

I found the issue where I forgot to add blocks in my index.html

<!-- build:<type>(alternate search path) <path> <parameters> -->
... HTML Markup, list of script / link tags.
<!-- endbuild -->