{"size": 2320, "ext": "js", "max_stars_repo_path": "gulpfile.babel.js", "max_stars_repo_name": "sam-tremblay/Gate", "max_stars_repo_stars_event_min_datetime": "2021-11-04T17:10:52.000Z", "max_stars_repo_stars_event_max_datetime": "2021-12-25T19:28:47.000Z", "max_issues_repo_path": "gulpfile.babel.js", "max_issues_repo_name": "sam-tremblay/Gate", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "gulpfile.babel.js", "max_forks_repo_name": "sam-tremblay/Gate", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 3, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 23.2, "max_line_length": 92, "alphanum_fraction": 0.6314655172}
'use strict';

import gulp from 'gulp';
import dartSass from 'sass';
import gulpSass from 'gulp-sass';
import babel from 'gulp-babel';
import babelregister from '@babel/register';
import uglify from 'gulp-uglify';
import concat from 'gulp-concat';
import imagemin from 'gulp-image';
import fontmin from 'gulp-fontmin';
import plumber from 'gulp-plumber';
const sass = gulpSass(dartSass);

const THEME_NAME = "gate-child";



// Gestion du wp-config.php
gulp.task('wp-config', () =>
  gulp.src(['./workspace/wp-config.php'])
  .pipe(gulp.dest('./final'))
);


// Dossier Template
gulp.task('template', () =>
  gulp.src(['./workspace/themes/'+ THEME_NAME +'/template/**/*'])
  .pipe(gulp.dest('./final/wp-content/themes/'+ THEME_NAME +''))
);


// SCSS Frontend
gulp.task('scss', () =>
  gulp.src(['./workspace/themes/'+ THEME_NAME +'/scss/**/*.scss'])
  .pipe(sass({outputStyle: 'compressed'}).on('error', sass.logError))
  .pipe(concat('main.min.css'))
  .pipe(gulp.dest('./final/wp-content/themes/'+ THEME_NAME +'/assets/css'))
);


// JS Frontend
gulp.task('js', () =>
  gulp.src(['./workspace/themes/'+ THEME_NAME +'/js/**/*.js'])
  .pipe(babel())
  .pipe(uglify())
  .pipe(concat('main.min.js'))
  .pipe(gulp.dest('./final/wp-content/themes/'+ THEME_NAME +'/assets/js'))
);



// Optimisation des images
gulp.task('images', () =>
  gulp.src(['./workspace/themes/'+ THEME_NAME +'/images/**/*'])
  .pipe(imagemin())
  .pipe(gulp.dest('./final/wp-content/themes/'+ THEME_NAME +'/assets/images'))
);


// Optimisation des fonts
gulp.task('fonts', () =>
  gulp.src(['./workspace/themes/'+ THEME_NAME +'/fonts/**/*.ttf'])
  .pipe(fontmin())
  .pipe(gulp.dest('./final/wp-content/themes/'+ THEME_NAME +'/assets/fonts'))
);


gulp.task('watch', function () {

  gulp.watch(['./workspace/wp-config.php'], gulp.series('wp-config'))

  gulp.watch(['./workspace/themes/'+ THEME_NAME +'/template/**/*'], gulp.series('template'))

  gulp.watch(['./workspace/themes/'+ THEME_NAME +'/scss/**/*.scss'], gulp.series('scss'))
  
  gulp.watch(['./workspace/themes/'+ THEME_NAME +'/js/**/*.js'], gulp.series('js'))

});



// Watch task
gulp.task('default', gulp.series(
  'wp-config',
  'template',
  'scss',
  'js',
  'watch'
));


gulp.task('prod', gulp.series(
  'wp-config',
  'template',
  'scss',
  'js',
  'images',
  'fonts'
));