<commit_before>'use strict';

var gulp = require('gulp'),
    plumber = require('gulp-plumber'),
    newer = require('gulp-newer'),
    imagemin = require('gulp-imagemin');

gulp.task('styles', function() {
    var sass = require('gulp-sass');
    var postcss = require('gulp-postcss');
    var autoprefixer = require('autoprefixer-core');

    return gulp.src('assets/scss/*.scss')
        .pipe(plumber())
        .pipe(sass({
            outputStyle: 'compressed'
        }))
        .pipe(postcss([ autoprefixer({ browsers: ['last 2 versions'] }) ]))
        .pipe(gulp.dest('web/css'));
});

gulp.task('js', function() {
    var browserify = require('browserify');
    var source = require('vinyl-source-stream');
    var buffer = require('vinyl-buffer');
    var globby = require('globby');
    var through = require('through2');
    var gutil = require('gulp-util');
    var uglify = require('gulp-uglify');

    var bundledStream = through();

    bundledStream
        .pipe(source('app.js'))
        .pipe(buffer())
        .pipe(uglify())
        .on('error', gutil.log)
        .pipe(gulp.dest('web/js'));

    globby(['./assets/js/*.js'], function(err, entries) {
        if (err) {
            bundledStream.emit('error', err);
            return;
        }

        var b = browserify({
            entries: entries,
            debug: false
        });

        b.bundle().pipe(bundledStream);
    })
});

gulp.task('jpg', function() {
    var imageminJpegRecompress = require('imagemin-jpeg-recompress');

    return gulp.src('assets/images/**/*.jpg')
        .pipe(plumber())
        .pipe(imageminJpegRecompress({ loop: 3 })())
        .pipe(gulp.dest('web/images'));
});

gulp.task('png', function() {
    var imageminPngquant = require('imagemin-pngquant');

    return gulp.src('assets/images/**/*.png')
        .pipe(plumber())
        .pipe(imageminPngquant({ quality: '65-80', speed: 4 })())
        .pipe(gulp.dest('web/images'));
});

gulp.task('images', ['jpg', 'png']);

gulp.task('fonts', function() {
    var fontmin = require('gulp-fontmin');

    return gulp.src('assets/fonts/**/*')
        .pipe(plumber())
        .pipe(fontmin())<commit_msg>Utilisation de newer dans les tâches jpg, png et fonts<commit_after>'use strict';

var gulp = require('gulp'),
    plumber = require('gulp-plumber'),
    newer = require('gulp-newer'),
    imagemin = require('gulp-imagemin');

gulp.task('styles', function() {
    var sass = require('gulp-sass');
    var postcss = require('gulp-postcss');
    var autoprefixer = require('autoprefixer-core');

    return gulp.src('assets/scss/*.scss')
        .pipe(plumber())
        .pipe(sass({
            outputStyle: 'compressed'
        }))
        .pipe(postcss([ autoprefixer({ browsers: ['last 2 versions'] }) ]))
        .pipe(gulp.dest('web/css'));
});

gulp.task('js', function() {
    var browserify = require('browserify');
    var source = require('vinyl-source-stream');
    var buffer = require('vinyl-buffer');
    var globby = require('globby');
    var through = require('through2');
    var gutil = require('gulp-util');
    var uglify = require('gulp-uglify');

    var bundledStream = through();

    bundledStream
        .pipe(source('app.js'))
        .pipe(buffer())
        .pipe(uglify())
        .on('error', gutil.log)
        .pipe(gulp.dest('web/js'));

    globby(['./assets/js/*.js'], function(err, entries) {
        if (err) {
            bundledStream.emit('error', err);
            return;
        }

        var b = browserify({
            entries: entries,
            debug: false
        });

        b.bundle().pipe(bundledStream);
    })
});

gulp.task('jpg', function() {
    var imageminJpegRecompress = require('imagemin-jpeg-recompress');

    return gulp.src('assets/images/**/*.jpg')
        .pipe(plumber())
        .pipe(newer('web/images'))
        .pipe(imageminJpegRecompress({ loop: 3 })())
        .pipe(gulp.dest('web/images'));
});

gulp.task('png', function() {
    var imageminPngquant = require('imagemin-pngquant');

    return gulp.src('assets/images/**/*.png')
        .pipe(plumber())
        .pipe(newer('web/images'))
        .pipe(imageminPngquant({ quality: '65-80', speed: 4 })())
        .pipe(gulp.dest('web/images'));
});

gulp.task('images', ['jpg', 'png']);

gulp.task('fonts', function() {
    var fontmin = require('gulp-fontmin');

    return gulp.src('assets/fonts/**/*')
        .pipe(plumber())
        .pipe(newer('web/fonts'))
        .pipe(fontmin())
{'fraction_non_alphanumeric': 0.19395689846700734, 'fraction_numerical': 0.003554765607642746, 'mean_word_length': 2.6811120196238756, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1485680', 'n_tokens_mistral': 1516, 'n_tokens_neox': 1460, 'n_words': 255}