<commit_before>
////////////////////////////////
    //Setup//
////////////////////////////////

// Plugins
const gulp = require('gulp');
const pjson = require('./package.json');
const gutil = require('gulp-util');
const sass = require('gulp-sass');
const autoprefixer = require('gulp-autoprefixer');
const cssnano = require('gulp-cssnano');
const rename = require('gulp-rename');
const del = require('del');
const plumber = require('gulp-plumber');
const pixrem = require('gulp-pixrem');
const uglify = require('gulp-uglify');
const imagemin = require('gulp-imagemin');
const browserSync = require('browser-sync').create();
const babel = require('gulp-babel');
const sourcemaps = require('gulp-sourcemaps');
const reload = browserSync.reload;


// Relative paths function
let pathsConfig = appName => {
  const app = `./${appName || pjson.name}`;

  return {
    templates: `${app}/templates`,
    css: `${app}/static/dist/css`,
    sass: `${app}/static/sass`,
    fonts: `${app}/static/fonts`, 
    images: `${app}/static/images`,
    js: `${app}/static/js`,
    distJs: `${app}/static/dist/js`,
    app
  }
};

const paths = pathsConfig();

////////////////////////////////
    //Tasks//
////////////////////////////////

// Styles autoprefixing and minification
gulp.task('styles', () => {
  return gulp.src(`${paths.sass}/main.scss`)
    .pipe(sourcemaps.init())
      .pipe(sass().on('error', sass.logError))
      .pipe(plumber()) // Checks for errors
      .pipe(autoprefixer({browsers: ['last 2 version']})) // Adds vendor prefixes
      .pipe(pixrem())  // add fallbacks for rem units
      .pipe(rename({ suffix: '.min' }))
      .pipe(cssnano()) // Minifies the result
    .pipe(sourcemaps.write('./maps'))
    .pipe(gulp.dest(paths.css));
});

// Javascript minification
gulp.task('scripts', () => {
  return gulp.src([`${paths.js}/**/*.js`, `!**/*.min.js`])
    .pipe(plumber()) // Checks for errors
    .pipe(sourcemaps.init())
      .pipe(babel())
      .pipe(uglify()) // Minifies the js
      .pipe(rename({ suffix: '.min' }))
    .pipe(sourcemaps.write('./maps'))
    .pipe(gulp.dest(paths.distJs));
});

// Image compression
gulp.task('imgCompression', () => {
  return gulp.src(`${paths.images}/*`)
    .pipe(imagemin()) // Compresses PNG, JPEG, GIF and SVG images
    .pipe(gulp.dest(paths.images))
});

// Browser sync server for live reload
gulp.task('browserSync', () => {
    browserSync.init(
      [`${paths.css}/*.css`, `${paths.js}/*.js`, `${paths.templates}/*.html`], {
        proxy:  "localhost:8000",
        open: false
    });
});

// Default task
gulp.task('default', ['styles', 'scripts', 'imgCompression']);

////////////////////////////////
    //Watch//
////////////////////////////////

// Watch
gulp.task('watch', ['default', 'browserSync'], () => {
  gulp.watch(`${paths.sass}/*.scss`, ['styles']);
  gulp.watch(`${paths.js}/*.js`, ['scripts']).on("change", reload);
  gulp.watch(`${paths.images}/*`, ['imgCompression']);
  gulp.watch(`${paths.templates}/**/*.html`).on("change", reload);
});<commit_msg>Watch scss files<commit_after>
////////////////////////////////
    //Setup//
////////////////////////////////

// Plugins
const gulp = require('gulp');
const pjson = require('./package.json');
const gutil = require('gulp-util');
const sass = require('gulp-sass');
const autoprefixer = require('gulp-autoprefixer');
const cssnano = require('gulp-cssnano');
const rename = require('gulp-rename');
const del = require('del');
const plumber = require('gulp-plumber');
const pixrem = require('gulp-pixrem');
const uglify = require('gulp-uglify');
const imagemin = require('gulp-imagemin');
const browserSync = require('browser-sync').create();
const babel = require('gulp-babel');
const sourcemaps = require('gulp-sourcemaps');
const reload = browserSync.reload;


// Relative paths function
let pathsConfig = appName => {
  const app = `./${appName || pjson.name}`;

  return {
    templates: `${app}/templates`,
    css: `${app}/static/dist/css`,
    sass: `${app}/static/sass`,
    fonts: `${app}/static/fonts`, 
    images: `${app}/static/images`,
    js: `${app}/static/js`,
    distJs: `${app}/static/dist/js`,
    app
  }
};

const paths = pathsConfig();

////////////////////////////////
    //Tasks//
////////////////////////////////

// Styles autoprefixing and minification
gulp.task('styles', () => {
  return gulp.src(`${paths.sass}/main.scss`)
    .pipe(sourcemaps.init())
      .pipe(sass().on('error', sass.logError))
      .pipe(plumber()) // Checks for errors
      .pipe(autoprefixer({browsers: ['last 2 version']})) // Adds vendor prefixes
      .pipe(pixrem())  // add fallbacks for rem units
      .pipe(rename({ suffix: '.min' }))
      .pipe(cssnano()) // Minifies the result
    .pipe(sourcemaps.write('./maps'))
    .pipe(gulp.dest(paths.css));
});

// Javascript minification
gulp.task('scripts', () => {
  return gulp.src([`${paths.js}/**/*.js`, `!**/*.min.js`])
    .pipe(plumber()) // Checks for errors
    .pipe(sourcemaps.init())
      .pipe(babel())
      .pipe(uglify()) // Minifies the js
      .pipe(rename({ suffix: '.min' }))
    .pipe(sourcemaps.write('./maps'))
    .pipe(gulp.dest(paths.distJs));
});

// Image compression
gulp.task('imgCompression', () => {
  return gulp.src(`${paths.images}/*`)
    .pipe(imagemin()) // Compresses PNG, JPEG, GIF and SVG images
    .pipe(gulp.dest(paths.images))
});

// Browser sync server for live reload
gulp.task('browserSync', () => {
    browserSync.init(
      [`${paths.css}/*.css`, `${paths.js}/*.js`, `${paths.templates}/*.html`], {
        proxy:  "localhost:8000",
        open: false
    });
});

// Default task
gulp.task('default', ['styles', 'scripts', 'imgCompression']);

////////////////////////////////
    //Watch//
////////////////////////////////

// Watch
gulp.task('watch', ['default', 'browserSync'], () => {
  gulp.watch(`${paths.sass}/*.scss`, ['styles']).on("change", reload);
  gulp.watch(`${paths.js}/*.js`, ['scripts']).on("change", reload);
  gulp.watch(`${paths.images}/*`, ['imgCompression']);
  gulp.watch(`${paths.templates}/**/*.html`).on("change", reload);
});
{'fraction_non_alphanumeric': 0.27483660130718957, 'fraction_numerical': 0.0016339869281045752, 'mean_word_length': 2.766769230769231, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 15, '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': '5161664', 'n_tokens_mistral': 2018, 'n_tokens_neox': 2000, 'n_words': 377}