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 don't make the changes #234

Closed SaadLaggoun closed 7 years ago

SaadLaggoun commented 7 years ago

I did some changes on HTML file outside build comment and starts useref task..Nothing happened...What i did outside the build comment isn't in the output, the HTML file is keeping the first output from the first run of the task. I noticed right now that the changes that i made in other files isn't in the outputs as well.

// Path's directory
var path = {
  src: {
    css: './app/css',
    fonts: './app/fonts',
    icons: './app/icons',
    images: './app/img',
    js: './app/js',
    index: './app/index.html'
  },
  dest: {
    css: './css',
    fonts: './fonts',
    icons: './icons',
    images: './img',
    js: './js',
    index: './'
  }
};
// Send files to the main directory
gulp.task('send-files', function () {

  // Send other files from css folder
  gulp.src('app/css/*.*')
      .pipe(gulpIgnore('*.css'))
      .pipe(gulp.dest(path.dest.css));

  // Send js files
  gulp.src(['./app/js/modernizr.js', './app/js/fastclick.js'])
      .pipe(plumber())
      .pipe(gulp.dest(path.dest.js));

  // Send fonts folder
  gulp.src(path.src.fonts += '/**/*.*')
      .pipe(g
```ulp.dest(path.dest.index += '/fonts/'));
});

// Combile unnecessary miscellaneous files into one main.min.css/js
gulp.task('useref', ['send-files'], function (cb) {
  pump([
            gulp.src(path.src.index),
        plumber(),
              useref(),
              // minify js files
              gulpif('*.js', uglify()),
              // minify css files
        gulpif('*.css', cssnano()),
              gulpif('*.css', autoprefixer()),
              gulp.dest(path.dest.index)
    ],
    cb
  );
});

// Watch task
gulp.task('watch', function () {
  gulp.watch('./app/**/*.+(html|css|js)', ['useref']);
});
jonkemp commented 7 years ago

You could try removing the dest files before you run it, like in a clean up task or something.

SaadLaggoun commented 7 years ago

@jonkemp doesn't work either. and the task not working this time at all!

jonkemp commented 7 years ago

My guess is something else is wrong then.

SaadLaggoun commented 7 years ago

I solve the problem by remove the cache! thanks man for the great plugin <3